Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

What are the Names for the "TEST" Switches??

by mmartin (Monk)
on Oct 11, 2012 at 17:36 UTC ( #998494=perlquestion: print w/ replies, xml ) Need Help??
mmartin has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I had just a simple question about these "Test" Switches/Flags (*That's just what I've been calling them...).
I own the O'REILLY "Programming Perl" 3rd Edition Book. And I'm trying to find a list of switches/flags.

I'm not looking for the Command Line Switches, which the book only seems to show in the index. But I'm
looking for the "switches" that you can use in, for example an if statement...

For Example:
# Use "-e" to test is the file exists... MY_FILE="/home/my_filename.txt" if ( -e $MY_FILE ) { print "The File Exists\n\n"; } else { print "The File DOES NOT Exists\n\n"; }

Do these "Test Switches" have a special name? And could anyone tell me of a good link where I could find these..?


Any thoughts would be great!

Thanks in Advance,
Matt

Comment on What are the Names for the "TEST" Switches??
Download Code
Re: What are the Names for the "TEST" Switches??
by toolic (Chancellor) on Oct 11, 2012 at 17:38 UTC
Re: What are the Names for the "TEST" Switches??
by jandrew (Hermit) on Oct 11, 2012 at 18:05 UTC
Re: What are the Names for the "TEST" Switches??
by mmartin (Monk) on Oct 11, 2012 at 18:34 UTC
    Hey toolic & jandrew, thanks for the replies!!

    Awesome, that'd be it! Thanks for that...


    Thanks Again,
    Matt

Re: What are the Names for the "TEST" Switches??
by greengaroo (Hermit) on Oct 11, 2012 at 19:40 UTC

    These are called "file test operators" and in my Programming Perl 2nd Ed. they are well covered in Chapter 2 - Operators (page 85). But since you have the 3rd edition, check in the index for "file test operator".

    There are no stupid questions, but there are a lot of inquisitive idiots.
Re: What are the Names for the "TEST" Switches??
by thomas895 (Hermit) on Oct 12, 2012 at 07:03 UTC

    If you want to see the (outdated, but probably more-or-less the same) documentation, see perlfunc:_X, right from the comfort of PerlMonks!

    ~Thomas~
    confess( "I offer no guarantees on my code." );
Re: What are the Names for the "TEST" Switches??
by kcott (Abbot) on Oct 12, 2012 at 08:20 UTC

    G'day mmartin,

    Specifically for the book in question:

    Programming Perl, Third Edition
    Chapter 3: Unary and Binary Operators   (p. 86)
    Named Unary and File Test Operators   (p. 95)
    Table 3-4: File Test Operators   (p. 98)

    -- Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://998494]
Approved by toolic
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2014-08-28 09:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (259 votes), past polls