On 05 Jul 2001 13:01:33 -0400, Tim Musson wrote:
> perlers,
>
> I want to split to @Group only if the 3rd element of @Line has data.
> It works, but I get an error (Use of uninitialized value in split)
> using -w, strict, and diagnostics. Should I be doing this differently?
>
> I run this with a filename parm, and the file contains:
> uid1,cn 1,ua_bit_essd
> uid2,cn 2,ua_bit_essd_si
> uid3,cn 3,
>
> I would like to put nothing in $Group[-1] if $Line[2] is empty.
>
> while (<>) { chomp;
> my @Line = split(/,/);
>
> my @Group = split(/_/, $Line[2]) if ($Line[2]); # err msg here for uid3
>
> print "\n", $Line[0], $Line[1], " $Group[-1]"; # testing
> }
>
> Thanks!
>
> --
> [EMAIL PROTECTED]
> Using The Bat! eMail v1.53d
> Windows NT 5.0.2195 (Service Pack 1)
> Luxuriantly hand-crafted from only the finest ASCII.
>
>
WAG: try
my @Group = split(/_/, $Line[2]) if (defined($Line[2]));
--
Today is Sweetmorn, the 40th day of Confusion in the YOLD 3167
Umlaut Zebra über alles!