in reply to Re: Printing octal characters
in thread Printing octal characters

No, that doesn't work. The octal numbers in the foreach loop are converted into decimal internally, so within the loop $_ is actually in decimal, not octal. So you don't need the oct function. In fact, putting in the oct function is wrong, and it will give you errors ("Illegal octal digit ignored ...").

You can tell by looking at what $_ prints out in your print statement. So you really just need

print chr $_;

Replies are listed 'Best First'.
RE: RE: Re: Printing octal characters
by perlmonkey (Hermit) on Apr 25, 2000 at 22:50 UTC
    Doh, you are quite correct. Sorry.

    To print out every possble character this should do it:
    foreach (0 .. 255) { print chr($_)." $_\n"; }
    So to print out the oct 277 you can do "print chr(oct(277))"

    I think I am correct this time.