noobee has asked for the wisdom of the Perl Monks concerning the following question:
Hi Folks,
I have a file with over 1000 words in first column and
some value in the second column.
I am using the following piece of code:
In some cases, $key has a long string containing around 100 words in it. When I use the above code, I see that my $key is "pruned" to the number of '<' I have in format NEW_FORMAT. I want to print the whole string that $key is equal to. How do I do this? Thanks in advance for the help! --Jessicamy %datahash; open(OUTFILE,">","$log"); my $ofh = select(OUTFILE); $~ = "NEWFORMAT"; $^ = "NEWFORMAT_TOP"; $^L = ""; select($ofh); format NEWFORMAT_TOP = -Page Number- @||| $%, +-----------------------------------+------------+ | | | | Data String | Value | +-----------------------------------+------------+ . foreach my $key (keys %datahash) { format NEWFORMAT = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @###.## $key, @datahash{$key} . write(OUTFILE); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Help with formatting a text file
by artist (Parson) on Jan 25, 2008 at 19:44 UTC | |
Re: Help with formatting a text file
by Anonymous Monk on Jan 25, 2008 at 20:33 UTC | |
Re: Help with formatting a text file
by Narveson (Chaplain) on Jan 25, 2008 at 20:21 UTC | |
Re: Help with formatting a text file
by apl (Monsignor) on Jan 25, 2008 at 20:54 UTC | |
Re: Help with formatting a text file
by noobee (Acolyte) on Jan 25, 2008 at 21:03 UTC | |
Re: Help with formatting a text file
by moklevat (Priest) on Jan 26, 2008 at 19:18 UTC |
Back to
Seekers of Perl Wisdom