Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: shift implicit dereference

by kcott (Abbot)
on Oct 06, 2013 at 17:39 UTC ( #1057173=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/env perl -l
    
    ...
        print ${shift(@_)};
        print ${shift};
    }
    
  2. or download this
    Ambiguous use of ${shift} resolved to $shift at ./junk line 15.
    A
    ...
    C
    D
    E
    
  3. or download this
    $ perl -Mstrict -Mwarnings -le 'print (1==0) ? "true" : "false"'
    print (...) interpreted as function at -e line 1.
    ...
    
    $ perl -Mstrict -Mwarnings -le 'print +(1==0) ? "true" : "false"'
    false
    
  4. or download this
    $ perl -Mstrict -Mwarnings -MData::Dump -e 'dd [map { my $y = uc; {$y 
    +=> 1} } "a".."c"]'
    ["A", 1, "B", 1, "C", 1]
    
    $ perl -Mstrict -Mwarnings -MData::Dump -e 'dd [map { my $y = uc; +{$y
    + => 1} } "a".."c"]'
    [{ A => 1 }, { B => 1 }, { C => 1 }]
    
  5. or download this
    $ perl -Mstrict -Mwarnings -le 'use constant X => "a"; my %h = (a => 1
    +); print $h{X}'
    Use of uninitialized value in print at -e line 1.
    
    $ perl -Mstrict -Mwarnings -le 'use constant X => "a"; my %h = (a => 1
    +); print $h{+X}'
    1
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1057173]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2015-07-31 03:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls