in reply to single line to multiple line

use warnings; use strict; while (<>) { chomp; my ($name,@rest)= split(/\s*;\s*/,$_); foreach (@rest) { print $name,'; ',$_,"\n"; } }

this will print the result to the screen, but if you call this script with

thisscript old.txt > new.txt

the output gets stored in the file new.txt. Or you can change the script to explicitly open a file with the open() function and print to it

Replies are listed 'Best First'.
Re^2: single line to multiple line
by thalumus (Initiate) on Jun 06, 2009 at 03:37 UTC
    It works. Thank you very much. Glad to attend this great perl family.