Placed in () when used with if, while, etc...
Any expression is considered true as long as it does not evaluate to the null string ("") or 0 or "0".
Common: http://www.perldoc.com/perl5.6/pod/perlop.html
``lt'', ``le'', ``ge'', ``gt'' and ``cmp'' use the collation (sort) order specified by the current locale if use locale is in effect. See the perllocale manpage.
File-test operators http://www.perldoc.com/perl5.6/pod/func/X.html
Example:
while (<>) { chop; next unless -f $_; # ignore specials #... }
Example:
print "Can do.\n" if -r $a || -w _ || -x _;
stat($filename); print "Readable\n" if -r _; print "Writable\n" if -w _; print "Executable\n" if -x _;
See also:
Uppercase operators (e.g. EQ instead of eq) used to be ok, but they aren't anymore. They cause "bareword found where operator expected" errors as of perl version 5. +
file: /Techref/language/perl/condition.htm, 4KB, , updated: 2009/12/29 16:47, local time: 2024/9/16 03:22,
34.231.180.210:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://piclist.com/techref/language/perl/condition.htm"> Perl conditions</A> |
Did you find what you needed? |
PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Welcome to piclist.com! |
.