in reply to Store data into array by looping?
Replying on the UPDATE (you really should create a new question, as older questions get ignored in favour of new questions).
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 #
|
---|
In Section
Seekers of Perl Wisdom