use strict; my $Car0 = "2011 Chevy Camaro"; my $Car1 = "2011 Dodge Ram Crew Cab Short Bed"; my $Car2 = "2011 Ford F150 Platinum"; my $Car3 = "2011 Ford Flex"; my $Car4 = "2011 Ford Transit"; my $Car5 = "2011 GMC Cargo Van Extended"; my $Car6 = "2011 Hyundai Genesis Coupe"; my $Car7 = "2011 Kia Sol"; my $Car8 = "2011 Nissan Cube"; my $Car9 = "2011 Toyota Prius"; my $OneCar = ""; my $Year = 0; my $Make = ""; my $Model = ""; push( my @CarInfo, ( $Car0, $Car1, $Car2, $Car3, $Car4, $Car5, $Car6, $Car7, $Car8, $Car9 ) ); foreach $OneCar( @CarInfo ) { # initialize the variables $Year = $OneCar; $Make = $OneCar; $Model = $OneCar; # drop everything after the Year including the first space char $Year =~ s/\s.*//; # drop the year and the first space char $Make =~ s/\d*\s*//; # drop everything after the Make including the first space char $Make =~ s/\s.*//; # drop the year and the first space char, same as with $Make $Model =~ s/\d*\s//; # drop everything up to and including the first space char $Model =~ s/\w*\s//; print "$Year\t\t$Make\t\t$Model\n"; }