Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.
Quick
- ($a, $b....) = unpack("A2A7...", $packed)
- push( array, list )
Thursday, April 10, 2014
Perl chain
I knew it was possible to 'chain' one Perl script from another with do, but I could never see how to give the second script arguments.
But of course it turns out to be easy: you just explicitly set @ARGV before you 'do'. The second script is eval'd in the same global scope that the 'do' is in, so it gets the @ARGV that you set.
Btw in this situation, $0 does not change inside the 'do' - it's still the name of the first script.
Should point out that 'chain' isn't quite the right word - control of course returns to the first script after the 'do' is complete. 'Chain' implies that script 1 finishes when script 2 begins.