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

Re: if fooled by pesky leading white space

by Fletch (Bishop)
on Jul 14, 2008 at 03:37 UTC ( [id://697374]=note: print w/replies, xml ) Need Help??


in reply to if fooled by pesky leading white space

It's not if, it's eq; the string "abc" is not equal to " abc" (computers are quite pedantic that way). If stripping white space is causing problems elsewhere then create a stripped copy and compare that instead.

( my $staff_last_clean = $staff[ $i * 3 + $staff_last ] ) =~ s/^\s+//; if( $staff_last_clean eq $names[ 0 ] ) { # ... }

That'll leave the original untouched for elsewhere.

The cake is a lie.
The cake is a lie.
The cake is a lie.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2024-04-23 13:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found