Irishboy24 has asked for the wisdom of the Perl Monks concerning the following question:
Hey Monks, I am writing a script which read a text file and sorts the data in a more clinical way. i will explain in detail. say for ex we have a file called foo.txt. foo.txt contains the following:
The Rock|Cheer|Rock Bottom Triple H|Boo|Pedigree Stone Cold|Cheer|Stone Cold Stunner
Now my code should read the text file and sort the data in this way:
Wrestlername: The Rock Crowdreaction: Cheer Specialmove: RockBottom
i could only get this far. please let me know your ideas on how to do it.
#!/usr/bin/perl -w open(Handle,"D:\\scripts\\read.txt") || die "cannot read the file: $!" +; chomp(@row_data=<Handle>); close(Handle); print join (',',@row_data);
The output is as follows: The Rock|Cheer|Rock Bottom,Triple H|Boo|Pedigree,Stone Cold|Cheer|Ston +e Cold Stunner
Thanks
Irishboy
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Script issue involves File Handling.
by toolic (Bishop) on Oct 01, 2009 at 20:13 UTC | |
by Irishboy24 (Sexton) on Oct 01, 2009 at 20:31 UTC | |
by Irishboy24 (Sexton) on Oct 01, 2009 at 20:42 UTC | |
by toolic (Bishop) on Oct 01, 2009 at 20:54 UTC | |
|
Re: Script issue involves File Handling.
by ww (Archbishop) on Oct 01, 2009 at 20:47 UTC | |
by toolic (Bishop) on Oct 02, 2009 at 23:21 UTC | |
|
Re: Script issue involves File Handling.
by biohisham (Priest) on Oct 02, 2009 at 09:38 UTC |