Check For null Arguments - PerlMonks
文章推薦指數: 80 %
A better way to check for particular value is defined or not, use defined function in perl. ... defined function will return true if EXPR has a ... Yourskillwillaccomplishwhattheforceofmanycannot PerlMonks CheckFornullArguments byrfleisch(Initiate) Log inCreate a new user The Monastery Gates Seekers of Perl Wisdom Meditations Cool Uses For Perl Obfuscation Tutorials Poetry Reviews Perl News Donate Recent Threads Newest Nodes Super Search PerlMonks Discussion What's New onMar13,2013at15:21 UTC (#1023230=perlquestion:printw/replies,xml) NeedHelp?? rfleischhasaskedforthewisdomofthePerlMonksconcerningthefollowingquestion: Helloall, Ican'tseemtogetthecorrectsyntaktocheckforNOitemsonthecommandline. #!/usr/local/ActivePerl-5.16/bin/perl usePOSIXqw/strftime/; subfixdir{ my$dir=shift; opendirmy$DH,$dirordie"NotFound....$dir:$!"; while(my$f=readdir$DH){ nextifgrep$_eq$f,qw/.../; (my$new=$f)=~s/[^a-zA-Z0-9_.]/_/g; nextif($neweq$f); while(-e"$dir/$new"){$new.="1";} printSTDERR"Renaming:$f->$new\n"; rename"$dir/$f","$dir/$new"; fixdir("$dir/$new")if-d"$dir/$new"; } } $Do_Dir=@ARGV[0]; print("ARG=","$Do_Dir","<<<<<
延伸文章資訊
- 1Perl the swiss knife · Command Line Text Processing
passing argument to -l to set output record separator. $ seq 8 | perl -ne 'print if /[24]/' 2 4 $...
- 2perl + identify if param is empty value from ARG - Stack Overflow
How to identify if $param is a null value or empty value, same as [ -z from ksh? #!/usr/bin/perl ...
- 3PERL -- Options
If there are no digits, the null character is the separator. ... If -e is given, perl will not lo...
- 4Perl Display And Pass Command Line Arguments With @argv
Use the $ARGV[n] to display argument. We use the $#ARGV to get total number of passed argument to...
- 5Getopt::Long - Extended processing of command line options
To use Getopt::Long from a Perl program, you must include the following line in ... If an argumen...