Print auto-increment strings from Perl map -


this perl script prints output this

value value value value 
my $tree = html::treebuilder::xpath->new_from_content( $content );  @myvalue = $tree->findvalues('//html/body/center[1]/table/tbody/tr[4]/td[1]/following-sibling::td');   @myvalue = map {/^(\d+)/; $1} @myvalue; print join(' ', @myvalue); 

instead need print this

foostring1:value foostring2:value foostring3:value foostringn:value 

how prefix values integer-auto-incremented string?

the auto-increment operator you. necessary

my @values = qw/ value value value value /;  $key = 1; join ' ', map { 'foostring' . $key++ . ":$_" } @values; 

output

foostring1:value foostring2:value foostring3:value foostring4:value 

Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -