On Thu, Apr 24, 2014 at 8:40 PM, Harry Putnam <rea...@newsguy.com> wrote:
> my $dir2sr  = @{[shift]};

This shifts an element off @ARGV, makes an array reference containing
a single element (the value that was just shifted off), then
deferences that arrayref to create an array (which still contains a
single element, the value that was just shifted off), then assigns the
result of evaluating that array in a scalar context (which is the
number of elements in the array, i.e., 1) to $dir2sr.

(The same thing happens earlier, when you're pulling the first value
off @ARGV, but there the evaluation of the array is happening inside
qr//, which I guess imparts a list context so it DWyouM.)

In general, anywhere you're doing '@{[shift]}', unless you REALLY know
what's going on and why you'd want to do that ... instead just do
'shift'.

j.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to