in reply to Re^6: Problems with Hash Keys and Spaces
in thread Problems with Hash Keys and Spaces

Did the data in the array originate on Windows, and you chomped it? That would leave a chr 13 at the end of the string. Add
$Data::Dumper::Useqq = 1;

Just before the print Dumper.... If, as I suspect, it shows that $temp[1] really contains "Test MMA\r", you can use

$temp[1] =~ s/\r//;

to cleanse it.


Unless I state otherwise, all my code runs with strict and warnings

Replies are listed 'Best First'.
Re^8: Problems with Hash Keys and Spaces
by ZimCS (Novice) on Aug 12, 2008 at 15:04 UTC
    That is exactly it. I created a text file in windows, had it read into an array and chomped it. I will see if your solution works. Thanks!
      It worked! Thanks again. How did you go about figuring this out?
        From
        $VAR1 = [ '', ', 'Test MMA <------------------THIS LINE HERE '/dir/internal_stuff

        that is typical of a string with chr 13 at the end. I had in the back of my mind that Mac OS used chr 13 as an end of line character, hence my question about which OS you used. You replied unix (chr 10 at EOL). Your string's got chr 13. Windows uses chr 13 + chr 10, which, when chomped on NIX, would give you the string you had.