Guest User

Untitled

a guest
Jan 16th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. # Example:
  2. # Simple program called programming.pl
  3. use strict;
  4. use warnings;
  5. use Data::Dumper qw(Dumper);
  6.  
  7. print Dumper \@ARGV;
  8.  
  9. # Run the program like this: perl programming.pl -a --machine remote /etc
  10. # The output would be:
  11. $VAR1 = [ '-a',
  12. '--machine',
  13. 'remote',
  14. '/etc'
  15. ];
  16.  
  17. \!h # Extract command line arguments from @ARGV
  18.  
  19. # @ARGV is where the diamond operator looks when called, trying to determine what filenames it should use.
  20. # 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.
  21. # Example:
  22. @ARGV = qw(larry moe curly); # force these three files to be read
  23. while (<>) {
  24. chomp;
  25. say "It was $_ that I saw in some stooge-like file!";
  26. }
Add Comment
Please, Sign In to add comment