[wplug] Perl split on null?

larry at daberko.com larry at daberko.com
Tue May 20 15:50:32 EDT 2008


I figured it out.

split (/\0/, $value) worked.

Apparently, this isn't widely used. :-P

LBD

> I'm trying to split a string that's null delimited.
>
> Hexdump shows the data as:
> 00000e40  2f 75 73 65 72 73 2f 6c  61 72 72 79 64 00 00 4c
> |/users/larryd..L|
> 00000e50  61 72 72 79 20 44 61 62  65 72 6b 6f 00 2d 00 2d  |arry
> Daberko.-.-|
>
> Doing in perl:
>         @splitresult = split (//, $value);
>         $joinresult = join(':', @splitresult);
>         print "$joinresult\n";
> outputs:
> /:u:s:e:r:s:/:l:a:r:r:y:d:::L:a:r:r:y: :D:a:b:e:r:k:o::-::-
>
> Split does catch the null , but I want it to split ONLY on the null.
>
> Suggestions?
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
>



More information about the wplug mailing list