in reply to Assigning value to the array elements
#!/bin/perl5 use strict; use warnings; my @vars = qw( first second third fourth fifth sixth ); my @aarr = ('<chap', '<book', '<isb'); my %out; # hash to hold output my $i = 0; for (@aarr) { $out{$vars[$i]} = $_; $i++; } print "$out{first}\t$out{second}\t$out{third}\n"; __DATA__ ---------- Capture Output ---------- > "c:\perl\bin\perl.exe" _new.pl <chap <book <isb > Terminated with exit code 0.
|
|---|