On 11/13/07, Brown, Rodrick <[EMAIL PROTECTED]> wrote:

> How can I split a string based on this char? Or even print it in perl

Do you know specifically which character you want? Any character may
be represented by a backslash escape in a literal string. If you can
find your character on an ASCII table, you can use its hex or octal
code. Here's one ASCII table:

    http://www.engplanet.com/content/asciitable.html

The control character named SOH has the hex code of 01, so that would
become "\x01" in a double-quoted string. You'd write it the same way
in a split pattern:

  my @pieces = split /\x01/, $data;

There are other ways to do it. All of the backslash escapes are
documented under "Quote and Quote-like Operators" in the perlop
manpage:

    http://perldoc.perl.org/perlop.html#Quote-and-Quote-like-Operators

Is that all you needed? Cheers!

--Tom Phoenix
Stonehenge Perl Training

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to