Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The code I've below doesn't seem to work. What it attempts to do is read from a file (input.txt) and then format the input and print the formatted text to a file:
I've no idea how to bind the format to the printing part. Can someone please enlighten me?# input.txt contains two fields delimited by a pipe open (FH, "input.txt") or die $!; # Example # gary|1 # mary|10 # colin|2 # heidi seah|0 my ($name, $logins); open (FH2, ">formatted.txt") or die $!; format thisformat = @<<<<<<<<<<<<<<<<<<<<<@<<<<< $name $logins . while(my $line = <FH>) { chomp $line; ($name, $logins) = split /\|/, $line; print FH2 thisformat; #print FH2 "$name, $logins\n"; } close FH2;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with string formats
by gaal (Parson) on Feb 19, 2005 at 09:32 UTC | |
|
Re: Help with string formats
by perl_lover (Chaplain) on Feb 19, 2005 at 12:15 UTC |