in reply to Re: Re: otherwise condition
in thread otherwise condition

the chop is used to get rid of a semicolon that is always at the end of the pattern.

I would recommend either commenting that it is removing a semi-colon or using a pattern match to get rid of it, along the lines of $line =~ s/;$//;. Unless this is a script which has to execute in a specific amount of time, self-commenting code is much better than fast code.

------
We are the carpenters and bricklayers of the Information Age.

The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Replies are listed 'Best First'.
Re: Re3: otherwise condition
by menolly (Hermit) on Aug 25, 2003 at 18:30 UTC
    Or just drop the chop altogether and use
    $chain=substr($line,length($line)-2,1);
    instead of
    $chain=substr($line,length($line)-1,1);