in reply to Always Follow Up on Warnings
I've been known to rant about uninitialized warnings before... Here is one nice idiom for "cleaning" a series of undefined values.
Try the following code with and w/o this clensing line:$_ = '' for grep !defined, ($x,$y,$z);
#!/usr/bin/perl -wT use strict; my ($x,$y,$z) = (undef,'hello',undef); # undef "clensing" idiom $_ = '' for grep !defined, ($x,$y,$z); print "x='$x' y='$y' z='$z'\n";
-Blake
|
---|
Replies are listed 'Best First'. | |
---|---|
(crazyinsomniac) Re^2: Always Follow Up on Warnings
by crazyinsomniac (Prior) on Feb 08, 2002 at 04:00 UTC | |
by redsquirrel (Hermit) on Feb 08, 2002 at 05:33 UTC | |
by $code or die (Deacon) on Feb 08, 2002 at 11:20 UTC |
In Section
Meditations