I'm a perl newbie but it seems like it's now part of my job...
How can I capture the name of a file being piped to a perl script ?
I have this;
cat myfile | complicated.pl
It's a logfile analyser that's built around a while(<STDIN>)
loop and outputs a digest. I need to be able to tell what myfile
is within the script. I've tried variations on ARGV but I think they'd only work if the script was called like this;
Which I can't do, basically coz I'd have to rewrite the script and my level of perl knowledge is self evident from this post
It's also got to handle logrotation, I was thinking it might be easier to amend the logrotate script or is there a way I can capture a HUP within complicated.pl get it to close its currently open files and start crunching the new log file ?