Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: Array empty

by bart (Canon)
on Oct 05, 2003 at 14:11 UTC ( [id://296705]=note: print w/replies, xml ) Need Help??


in reply to Re: Array empty
in thread Split on . (dot)

Close. But ord($_) returns 0 not because it contains a null byte, but because it is an empty string.
print ord("");
prints: 0
(Where on earth would he be getting null bytes from?)

Indeed, the resulting array he's getting after doing

$ip = "21.23\n"; @t = split /./, $ip;
is
("", "", "", "", "", "\n")

The explanation: every character in the input string, except the newline, is used as a split delimiter. Thus you get, as a result, the stuff between those characters, which is nothing every time, except at the last character.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-26 03:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found