Loginskip to content

Archive for the 'perl' Category

Note by the way that the -e flag

Friday, October 27th, 2006

Note by the way that the -e flag has to be the last one before code; you can’t type perlew -p-n: Execute codefor every line from the input, and either print $_ automatically when done (-p) or not (-n). Say you want to find out the ASCII codes generated by certain keys on your keyboard; you could type % perl -pe ’s/(.)/” “.ord $1/ge’ and then hit a key followed by a newline to see its ASCII value. -l (the letter ‘ell’, not the number one): Append an automatic newline to printstatements. When combined with -nor -p, also automatically chomp the newline character off the input. Let’s say you want to find which users listed in a Unix /etc/passwdfile have directories under /home: % perl -nle ’s/:.*//; print if -d “/home/$_”‘ /etc/passwd This can most usefully be used as a first stage in a pipeline of commands that then go on to do other things with its results. Or you might want a Perl program as the final stage of a pipeline that periodically reports how many lines it has read: % … | perl -nle ‘BEGIN{ $SIG{ALRM} = sub{ print $.; alarm 10 }; alarm 10 }’ In this case, nothing at all is being executed in the loop for each line of input! The -l flag is particularly useful in one-liners or in short test programs in which you have only a handful of printstatements and want to save the trouble of typing nin all of them. However, don’t leave it in production code; setting a global flag like this affects the behavior of all print statements and will produce unpleasant results from using modules that don’t expect it (such as CGI.pmand Benchmark). -Mmodule: Perform a usemodule before executing any code. You can use this to impose strictness on your one-liners, and also as a quick test to see if a module you want is installed: % perl -MTime::HiRes -e 0 This prints nothing if the Time::HiResmodule is installed but complains if it isn’t. -c: This flag gives you the ability to check the syntax of a Perl program without actually running it. Because so much error checking is deferred until run-time in Perl,
Note: If you are looking for good and quality webspace to host and run your java application check Actions java hosting services

Integration testing. This is testing whether a

Friday, October 27th, 2006

Integration testing. This is testing whether a

Friday, October 27th, 2006

SQL => SQL, REG => REG); my %dbg;

Friday, October 27th, 2006

SQL => SQL, REG => REG); my %dbg;

Friday, October 27th, 2006

$opt_D = WEB | REG; # Default sub

Friday, October 27th, 2006

$opt_D = WEB | REG; # Default sub

Friday, October 27th, 2006

5.3 Raise the Flag Our option so far

Thursday, October 26th, 2006

5.3 Raise the Flag Our option so far

Thursday, October 26th, 2006

so you may want to strip off everything

Thursday, October 26th, 2006