in reply to Problem parsing and printing data from file
Okay, I just thought of a possibility: There is a carriage return in the $name field for that album. In that case, the data is all there, but when you print it, the carriage return is causing the data that follows it to overwrite everything before it.# $file = "$lsdir" . '/album' . "$album_nr" . '/album.dat'; # becomes $file = "$lsdir/album$album_nr/album.dat"; # open FILE, "$file" or # Don't quote variables unless you're constructing new strings open FILE $file or # $name = (/.*\"(.*)\"/)[0]; # no need for leading .*; better as ($name) = /"(.*)"/; # s/\n//g; # ($desc = (/.*\"(.+)\"/)[0]) || ($desc = ""); # Better as tr/\n//d; ($desc) = /"(.+)"/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Problem parsing and printing data from file
by Anonymous Monk on May 06, 2004 at 15:00 UTC | |
by Anonymous Monk on May 06, 2004 at 15:02 UTC | |
by Roy Johnson (Monsignor) on May 06, 2004 at 16:08 UTC |