Intermittent programming can lead to brain bleed off.
In the real script the command is something only found on solaris or
any other zfs filesystem so I just used the first simple command I
could think of. But the aim is to use the output of a command to
perform a string match. I left that out too, because even when
reduced to its most basic code `tst' still fails in the same way.
This little example below prints this error .. forever.
Use of uninitialized value $_ in print at ./tst line 11.
My first impulse was that I had the `dash' with the pipe operator on
the wrong side... but changing it does the same thing.
What is wrong with this example:
cat tst:
#!/usr/local/bin/perl
use strict;
use warnings;
my $cmd = 'ls /';
open my $ch, '-|', "$cmd" or die "Can't open $cmd: $!";
while ($ch) {
print;
}
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/