[Gllug] Poor scripting?!
Andrew Black - lists
andrew-lists at mail.black1.org.uk
Tue Mar 11 15:57:27 UTC 2008
Andrew Farnsworth wrote:
> Henrik,
> This won't work, mainly because the perl string operator 'eq' does not
> recognize wild cards (i.e. the * character). You will need to do a
> regex match to determine if ($_ =~ /cerprod$/) which will match the
> string 'cerprod' at the end of the string contained within the $_ variable.
Which can more succinctly be written as
if ( /cerprod$/ )
This is because $_ is the default operand to a match.
> $regexp = shift @ARGV
Would normally be written
$regexp = shift
It is a usage that is (IMHO) so common in Perl that I wouldn't stop to
think that it is looking at @ARGV
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list