in reply to shift operator

The Perl special variable @_ is the list of parameters passed to the sub. So:

hello ('Hello', 'world'); sub hello { my $hi = shift; my $place = shift; print "$hi $place\n"; }

Prints:

Hello world

Although many people would write the sub as:

sub hello { my ($hi, $place) = @_; print "$hi $place\n"; }

to use list assignment rather then shifting out multiple arguments. An even more sophisticated technique is to use "named" parameters by assigning to a hash instead of the positional technique just shown:

hello (hi => 'Hello', place => 'world'); sub hello { my %params = @_; print "$params{hi} $params{place}\n"; }

Further reading: perlsub, perlop and perlfunc.


DWIM is Perl's answer to Gödel