On Wednesday 28 November 2007 16:07, ciwei2103 wrote: > > Given a code segment: > > my $cmd = "/usr/symcli/bin/something"; > open (SYMCFG, " $cmd |" ) or die "cannot open $!\n"; > > while ( <SYMCFG> ) { > #print $_ if /FibreChannel Online$/ ; > # extract fields from the matching line > my ( $ident, $fa , $type, $status ) = (split )[0,1,4,5] if / > FibreChannel Online$/ ; > > print "$ident $fa $type $status \n" if defined $status ; > > } > close SYMCFG ; > > the sample output of running $cmd looks like: > > Ident Symbolic Numeric Slot Type Status > > DF-1A 01A 1 1 DISK Online > FA-4A 04A 4 4 FibreChannel Online > FA-13A 13A 13 13 FibreChannel Online > > the question: > I would expect to print out the field 0, 1, 4, 5 > from the above line, however, while the first 3 fields print OK, the > last field $status seem always got uninitialied and > > Use of uninitialized value at ./emc_device_matching_to_fa.pl line 32, > <SYMCFG> chunk 23.
It says "chunk 23" instead of "line 23" which means that you changed the Input Record Separator ($/) from its default value of "\n". So what did you change it to? As to your missing field, that is kind of hard to diagnose without being able to run the command myself. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/