display | more...
A concept in Perl. Magic variables are special variables that are set implicitly when certain things are done. These variables are often default input to Perl functions. The use of magic variables makes the code very compact, and almost completely unreadable. :)

Examples: @ARGV, $ARG, $1

Example of use:

while (<>) { # Loops through standard input (ARGV) line by line
             # For each iteration, $_ is set to the current line. Others are set as well, like $. (current line number).
  print;     # Print current line. Uses $_ implicitly by default.

Back to Perl

Log in or register to write something here or to contact authors.