[LA.pm] String handling like C array
Jeff
smawhoo at yahoo.com
Fri Feb 3 14:44:37 PST 2006
The "array level" needs better definition.
Depends on what you want exactly, in general, I guess unpack()
also traverse the string nicely.
Not sure if this answers your question.
- J
On Feb 3, 2006, at 2:31 PM, Robin Rowe wrote:
> I often walk through strings as arrays in C, an idiom something like
> this contrived example:
>
> void SwapXY(char* string)
> { char* ptr=string;
> while(*ptr)
> { const char c=*ptr;
> if('x'==c)
> { *ptr='y';
> }
> else if('y'==c)
> { *ptr='x';
> }
> ptr++;
> }
> }
>
> In Perl would I walk the string using substr and length or is there a
> better way to do array-level string manipulation?
>
> Robin
> _______________________________________________
> Losangeles-pm mailing list
> Losangeles-pm at pm.org
> http://mail.pm.org/mailman/listinfo/losangeles-pm
More information about the Losangeles-pm
mailing list