sub read_file { @lines = <>; chomp(@lines); for $line (@lines) { print join "\n", split ',', $line; print "\n" } } read_file;