Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Example:
- # Simple program called programming.pl
- use strict;
- use warnings;
- use Data::Dumper qw(Dumper);
- print Dumper \@ARGV;
- # Run the program like this: perl programming.pl -a --machine remote /etc
- # The output would be:
- $VAR1 = [ '-a',
- '--machine',
- 'remote',
- '/etc'
- ];
- \!h # Extract command line arguments from @ARGV
- # @ARGV is where the diamond operator looks when called, trying to determine what filenames it should use.
- # Because of how it works, you have a chance to tinker with it and force specific files, regardless of what the user chose on the command line.
- # Example:
- @ARGV = qw(larry moe curly); # force these three files to be read
- while (<>) {
- chomp;
- say "It was $_ that I saw in some stooge-like file!";
- }
Add Comment
Please, Sign In to add comment