in reply to Get Entire Command Line of a Program
As noted, you can get your commandline arguments, except for IO redirection, via @ARGV.
Whatever IO redirection has been specified is available within your Perl script via STDIN, STDOUT and STDERR.
Here's how you can get at the filenames:
$ perl -wE 'use IO::Handle; my $inode = (*STDERR{IO}->stat)[1]; say `f +ind -inum $inode`;' 2> derf ./derf $ perl -wE 'use IO::Handle; my $inode = (*STDOUT{IO}->stat)[1]; say `f +ind -inum $inode`;' > fred; cat fred ./fred
That obviously needs substantial error checking and other work for a serious script but hopefully it's at least a start in right direction.
-- Ken
|
|---|