in reply to Hashes or arrays in the command line
You probably want something like:cp /home/wbill/lazarus/file1 file2 .
What the foreach does is take every item in the array @FILES and places it in the variable $this_file - which is then used in the backticks#! /usr/bin/perl use strict; use warnings; my @FILES = ('file1',' file2'); my $path = "/home/wbill/lazarus"; foreach my $this_file ( @FILES ) { `cp $path/$this_file .`; }
More likely though you should consider using a module such as File::Copy rather than use backticks - it makes the code less platform dependent.
--tidiness is the memory loss of environmental mnemonics
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Hashes or arrays in the command line
by EvdB (Deacon) on Nov 20, 2003 at 18:29 UTC | |
|
Re: Re: Hashes or arrays in the command line
by tux242 (Acolyte) on Nov 20, 2003 at 18:47 UTC | |
by EvdB (Deacon) on Nov 20, 2003 at 19:02 UTC |