On Thu, Jun 19, 2008 at 1:57 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Do more simple and whit out numbers, some times the $1 .. are special > vars > > while (<input>) { > ($v1,$v2,$v3,$v4)=split(/,/,$_); > print <out> "$v1\n"; > print <out> "$v2\n"; > print <out> "$v3\n"; > print <out> "$v4\n"; > print <out> "\n"; > }
That drops anything after the fourth field. Unless this is desired, you can use an array and have it deal with any amount of fields. If your goal is simply to replace "," with "\n" via Perl (opposed to e.g. sed) you can do something likeL while( <$input> ) { print $output join( "\n", ( split( /,/, $_ ), "" ) ); } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/