Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: File Test operators, option -T

by zork42 (Monk)
on Sep 12, 2013 at 02:53 UTC ( #1053642=note: print w/ replies, xml ) Need Help??


in reply to File Test operators, option -T

Do you have the following near the start of your script?

use strict; # essential use warnings; # essential use autodie; # optional use diagnostics; # optional
The 2 "essentials" catch lots of errors and will save you lots of time. You should always use them!
If you'd had them in your script you'd have got this error message:

-T on closed filehandle $fh at script_name.pl line 2.

The 2 "optionals" can be very useful.
eg use autodie; would have given you this error message:

Can't open 'input2.txt' for reading: 'No such file or directory' at script_name.pl line 1

Documentation:
  • strict - Perl pragma to restrict unsafe constructs
  • warnings - Perl pragma to control optional warnings
  • autodie - Replace functions with ones that succeed or die with lexical scope
  • diagnostics - produce verbose warning diagnostics


Comment on Re: File Test operators, option -T
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (15)
As of 2015-07-03 12:07 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 (51 votes), past polls