Making Arrays
- Instead of
($cars[0], $cars[1], $cars[2]) = qw# mazda saab chevy #;
- Use the @ character to refer to the entire array:
@cars = qw# mazda saab chevy #;
- Think of @cars as "all of the cars"
| CPU: Perl, Fall 2005 | Perl, Week 2: Arrays, Hashes, Control Structures | #36 |
($cars[0], $cars[1], $cars[2]) = qw# mazda saab chevy #;
@cars = qw# mazda saab chevy #;
| Copyright © 2005 Ian Langworth |