David Nicol wrote: > On Tue, Jul 29, 2008 at 9:32 AM, Abigail <abigail@abigail.be> wrote: > >> It has been documented for a long, long time how to [handle leading/trailing space in 2-arg open]: >> >> my $file = " hello "; >> open my $fh, "< ./$file\0"; >> >> >> Granted, "\0" is a bit of an oddity, but it is possibly. And you don't >> need sysopen. >> > > so would > $_ = (m|^/| ? "< $_\0" : "< ./$_\0") for @ARGV; > work as a football safety device, inserted into the execution process > at the appropriate time (i.e. after getopts) > It would work on UNIX. :-) To make it work in more places, I would suggest doing the near opposite: $_ = (/^\s/ ? "< ./$_\0" : "< $_\0") for @ARGV; This is under the assumption that one can USE '/' on most platforms, but it may not BE '/' on all platforms. :-) Cheers, mark -- Mark Mielke <mark@mielke.cc>Thread Previous | Thread Next