Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: print if warn

by mkmcconn (Chaplain)
on Jan 15, 2002 at 00:02 UTC ( #138674=note: print w/replies, xml ) Need Help??


in reply to print if warn

I think that you are asking how to test for definedness

#!/usr/bin/perl -w use strict; my @a = qw(1 2 3); for (@a){ if ( not defined ($a[$_])){ print "\$a[$_] can't match because it's not initialized\n" unless $a[$_] =~ m/3/; print "\$a[$_] can't be tested for equivalence because it's not initialized\n" unless $a[$_] == 3; } }

mkmcconn

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2023-02-06 13:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (34 votes). Check out past polls.

    Notices?