Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: the repetition operator does not repeat "\x00" Why?

by Hofmator (Curate)
on Oct 10, 2006 at 11:02 UTC ( [id://577371]=note: print w/replies, xml ) Need Help??


in reply to the repetition operator does not repeat "\x00" Why?

The repetition operator works fine, try print length $_; it's Data::Dumper that does not output the '\x00' ...

-- Hofmator

Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Replies are listed 'Best First'.
Re^2: the repetition operator does not repeat "\x00" Why?
by djp (Hermit) on Oct 11, 2006 at 03:32 UTC
    Data::Dumper prints it for me (Perl 5.8.8, Solaris):
    perl -MData::Dumper -e '$_ = "\x00" x 4; print Dumper $_' | cat -v $VAR1 = '^@^@^@^@';
      You are correct, Data::Dumper prints the '\0' but it is only visible in the output via something like cat -v. Nice trick btw, I didn't know about that. Thank you!

      -- Hofmator

      Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-24 10:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found