Program Arguments
- Arguments to the program are put into the global @ARGV array
#!/usr/bin/perl
foreach (@ARGV) {
print "I like $_\n";
}
- Try it:
./my_program apples oranges ugly_fruit
| CPU: Perl, Fall 2005 | Perl, Week 4: More Arrays, Context, Subroutines, Lexical Variables | #13 |
#!/usr/bin/perl
foreach (@ARGV) {
print "I like $_\n";
}
./my_program apples oranges ugly_fruit
| Copyright © 2005 Ian Langworth |