in reply to How to access the hash array values?

I tried your script in another way. I condensed it and used the List::MoreUtils each_arrayref method and Data::Dumper. It'll give you a .h file and its contents; however, if you'd rather just get the first line of the files, just replace "cat" with "head -1".
#!/usr/bin/perl use strict; use List::MoreUtils qw(each_arrayref); use Data::Dumper::Concise; my @arr = ( '/root/Desktop/data/data.h', '/root/Desktop/power/power.h'); open STDOUT, '>', '/root/Desktop/arr.log'; my $iterator = each_arrayref(\@arr); grep{-f} glob( <*.h> ); foreach my $line(my @lines = &$iterator()) { print Dumper($arr[0]); print Dumper(system("cat $arr[0]")); print Dumper($arr[1]); print Dumper(system("cat $arr[1]")); } close STDOUT;