I'm trying to coble the code example below to perform work on the file name in the list. I have code that will pgp a single passed file name but I would like to loop through a file list and perform the same process against each filename in the list. How can i incorporate the $cmd component with the loop example such that each file_name in the list can be acted up on? I.e., i've tried substituting the print request with the cmd command but there's something fundamental i'm missing with this attempt
#code snippet that works in another script: $cmd = "gpg --recipient $gpg_key -q --yes -e $directory/$file_name"; $rc = system($cmd); #code loop example i'm having trouble combining with #!/usr/bin/perl -w use strict; my $file = "junk"; open (FH, "< $file") or die "Can't open $file for read: $!"; my @file_name; while (<FH>) { push (@file_name, $_); } close FH or die "Cannot close $file: $!"; print @file_name; # see if it worked
In reply to act on a file list by perl197
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |