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

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

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

html - jQuery UI Sortable - Remove placeholder after item is dropped -