Hi,

<SNIP>
On Fri, 1 Apr 2005, Brett Williams wrote:
> The text file reads,
>
> :Weekly expenses...:
> :1002.00:
> :125.00:
> :61864.35:
> :890876.99:
> :9.99:
>
> I want to print to screen all text between ":" on a new line. I
> thought this would be easy :)
> The final code i came up with is,
>
> open (INPUT, "file.txt") or die "Error, can't find file\n";
> $line = readline(INPUT);
> while($line)
> {
> chomp($line);
> @pricelist = split (/\:/, $line);
> print @pricelist;

  print "\n";
  ^^^^^^^^^^^^^
The above line should do the trick.

> $line = readline(INPUT);
> }
>
> For some reason this code prints out the entire contents of the text
> file (and fails to display every entry on a new line). Im completely
> lost, can anyone help?
</SNIP>

HTH,

Senthil



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to