http://www.perlmonks.org?node_id=874520


in reply to simple regex question

All, I ended up using the following method with push. Here it creates 4 arrays from 1 based on its initial character on each line(they are all the same) Thanks everyone for the help foreach $line(@exceptions) { if ($line =~ m/^n/) { $line =~ s/^n//s; push (@before, $line); } if ($line =~ m/^i/) { $line =~ s/^i//s; push (@implementation, $line); } if ($line =~ m/^b/) { $line =~ s/^b//s; push (@backup, $line); } if ($line =~ m/^o/) { $line =~ s/^o//s; push (@offline, $line); } }