in reply to Bad file descriptor when using backticks?
As far as I can see the only way to check for this case is to see if the `` operator returned undef:
update: as Fletch mentioned, `` does not set $! but $? so this code doesn't really work.my $hostname = `hostname`; unless (defined $hostname) { print "found error of: $!\n"; }
In addendum: be aware that not all functions that actually set $! are documented as doing so in the man pages. The only source that I know that seems to mention all of them is the Camel book.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Bad file descriptor when using backticks? (yes, $!)
by tye (Sage) on Feb 14, 2008 at 18:22 UTC |