jabowery has asked for the wisdom of the Perl Monks concerning the following question:
outputs:$|++; for (1..10){ $pid[$_]=open($fh[$_],"-|"); next if $pid[$_]; print; exit(0); } foreach my $i (1..10){ my $fh=$fh[$i]; while(<$fh[$i]>){ print "'$_'"; } close $fh[$i]; }
'GLOB(0x2535298)''GLOB(0x25352e0)''GLOB(0x2535418)''GLOB(0x2541e38)''G +LOB(0x2541ec8)''GLOB(0x25669d8)''GLOB(0x255ead8)''GLOB(0x2542420)''GL +OB(0x25523a8)''GLOB(0x2542dc8)'
but change $fh[$i] after its first occurance to $fh and it outputs:
'1''2''3''4''5''6''7''8''9''10'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: strange behavior of indexed list of globs
by davido (Cardinal) on Aug 03, 2013 at 21:43 UTC | |
by jabowery (Beadle) on Aug 03, 2013 at 23:32 UTC |
Back to
Seekers of Perl Wisdom