Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^4: no uninitialized warnings

by ccn (Vicar)
on Aug 25, 2004 at 16:46 UTC ( [id://385737]=note: print w/replies, xml ) Need Help??


in reply to Re^3: no uninitialized warnings
in thread no uninitialized warnings

or like this:

$_ = '[undef]' for grep !defined, $var1, $var2, $var3; print "$var1, $var2, $var3";

Update: I forgot that changing the values can affect program logic(as Aristotle mentioned). So, the best approach (imho) is just print with warnings or

use Data::Dumper; print Data::Dumper->Dump([$var1, $var2, $var3], [qw(var1 var2 var3)]);

Replies are listed 'Best First'.
Re^5: no uninitialized warnings
by Aristotle (Chancellor) on Aug 29, 2004 at 19:25 UTC

    Or non-destructively and unambiguously:

    print join " ", map { defined() ? "'\Q$_\E'" : 'undef' } $var1, $var2, + $var3;

    Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-26 03:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found