Hey Jeff & Others,
Thursday, July 05, 2001, 2:04:17 PM, my MUA believes you used
(X-Mailer not set) to write:
Thanks for the tip (don't my SOMETHING if CONDITION;).
I got the same response from 2 people. Is there a reason I should
pick one solution over the other? Or is this another case of
TMTOWTDI? <g>
JjP> It is inadvisable to do:
JjP> my SOMETHING if CONDITION;
JjP> because you cause Perl to do some weird things which I'd rather not get
JjP> into.
JjP> while (<>) {
JjP> chomp;
JjP> my @line = split /,/;
JjP> my @group = (@line == 3) ? split(/_/, $line[2]) : ();
JjP> print "$line[0] $line[1] $group[-1]\n";
JjP> }
DML> BEWARE of this construct, it has a hidden gotcha. Do this instead:
DML> my @Group;
DML> @Group = split(/_/, $Line[2]) if (defined($Line[2]));
DML> Otherwise, the 'my' is also inside of the 'if', which causes bizarre
DML> problems.
--
[EMAIL PROTECTED]
Using The Bat! (http://www.ritlabs.com/the_bat/) eMail v1.53d
Windows NT 5.0.2195 (Service Pack 1)
Why get even, when you can get odd?