Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: Re: getting 0 to print

by pfaut (Priest)
on Jan 13, 2003 at 21:40 UTC ( #226609=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: getting 0 to print
in thread getting 0 to print

You appear to be passing undefined values to your trim routine. If you want to substitute an empty string for undefined values, test with defined. if (!$_) is true for 0 and undefined values and your code was substituting an empty string for either. I think you only wanted the substitution for undefined values.

59 for(@out) { 60 #next if !($_); 61 if (!defined $_) { $_ = ""; } 62 s/^\s+//; 63 s/\s+$//; 64 s/\|//g; 65 s/\n//g; 66 s/\cM//g; 67 s/\r//g; 68 }
--- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';


Comment on Re: Re: Re: getting 0 to print
Select or Download Code
Re: Re: Re: Re: getting 0 to print
by rbc (Curate) on Jan 13, 2003 at 21:53 UTC
    Ah yes!
    if (!defined $_) { $_ = ""; }
    is most wise.
    Thank you O wise monk.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2014-07-24 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (156 votes), past polls