in reply to Store data into array by looping?
Just capture nand2_1 into a variable, like you already did, and then just break it into bits, like so:
my $gate_name = 'nand2_1'; my ($gtype, $gfirst, $gsecond) = ($gate_name =~ /^(\w+)(\d+)_(\d+)/); print "# $gtype # $gfirst # $gsecond #\n";
output:
# nand # 2 # 1 #
|
---|