[Gllug] Poor scripting?!
John Hearns
john.hearns at streamline-computing.com
Wed Mar 12 07:54:55 UTC 2008
On Tue, 2008-03-11 at 14:43 -0400, Andrew Farnsworth wrote:
> Andrew Black - lists wrote:
> > 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$/ )
> >
> You are correct, however, I NEVER use this form as it confuses non-perl
> programmers where ($_ =~ /cerprod$/)
As a suggestion then, use the better looking and elegant statement, and
comment it:
if ( /cerprod$/ ) # does the current $_ match with cerprod
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list