in reply to single line to multiple line

Another way?
#!/usr/bin/perl use strict; while (<DATA>) { chomp; my $name; s/^(\w+)\s?;// and $name = $1; for my $i ( split ";" ) { print "$name; $i\n"; } } __DATA__ alex ;teacher; 1945-12-1; california john; lawyer ; texas peter ;teacher; 1948-01-04