my($text) = "(network)(test)(ifcfg)"; my($first, $second, $third) = $text =~ /\((.*)\)\((.*)\)\((.*)\)/; print "$first and $second and $third\n";