in reply to Re^3: Perl Hash Files
in thread Perl Hash Files

thanks i have to use leading zero's because my text files are named 01 02 03 04, have to look for a way, can't i tell it not to change to octal? Do you mean it changed the hask key to octal?

Replies are listed 'Best First'.
Re: Perl Hash Files
by jonadab (Parson) on Dec 12, 2006 at 12:46 UTC
    Do you mean it changed the hask key to octal?

    No. Hash keys and filenames are strings, not numbers, so the leading zero does nothing in those cases and has no impact on your program. (Quite aside from that, you also have only one digit after the zero, so these numbers would be the same in octal as in decimal, except for 08 and 09, which aren't even valid in octal and would therefore still be interpreted as decimal, so there's another reason it has no impact.) He was just making you aware for future reference that if you have something like '024' and then treat it like a number (e.g., by adding another number to it), the results may not be quite what you might expect. That's probably why he called it a "small thing", because it doesn't have any impact on the operation of your current program.


    Sanity? Oh, yeah, I've got all kinds of sanity. In fact, I've developed whole new kinds of sanity. You can just call me "Mister Sanity". Why, I've got so much sanity it's driving me crazy.