Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 rifling through the Monastery: (4)
As of 2014-08-31 00:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls