Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Directory Listing to an Array

by cybear (Monk)
on Apr 17, 2002 at 14:56 UTC ( [id://159839]=note: print w/replies, xml ) Need Help??


in reply to Re: Directory Listing to an Array
in thread Directory Listing to an Array

what does the shift : "." do?

Replies are listed 'Best First'.
Re: Re: Re: Directory Listing to an Array
by japhy (Canon) on Apr 17, 2002 at 15:13 UTC
    The ?: operator is like a condensed if/else block.
    my $path; # if an argument was passed, use it if (@_) { $path = shift } # otherwise, use "." else { $path = "." }
    That can be written as my $path = @_ ? shift : "."; -- and if I wanted to be even shiftier (pun intended), I could do my ($path) = (@_, "."); but that's probably rude.

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a (from-home) job
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (8)
As of 2024-03-29 15:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found