moving file using perl

Brian McKee brian.mckee at gmail.com
Thu May 1 15:55:11 UTC 2008


On Thu, May 1, 2008 at 5:02 AM, Chris G <cl at isbd.net> wrote:
> On Thu, May 01, 2008 at 11:27:58AM +0300, OOzy Pal wrote:
>  > On Thu, May 1, 2008 at 10:54 AM, Chris G <cl at isbd.net> wrote:
>  > > On Thu, May 01, 2008 at 10:41:21AM +0300, OOzy Pal wrote:
>  > >  > Hello,
>  > >  >
>  > >  > How can I move a file to a directory name DONE using perl. I tried
>  > >  > this but it did not work?
>  > >  >
>  > >  > $file='Myfile';
>  > >  > rename $file, 'Done/'$file;
> you can't just
>  put 'Done/'$file and expect perl to concatenate the two.  You have to
>  use the string concatenation operator, e.g.:-
>
>     rename $file, 'Done/' . $file;
 or use double quotes - e.g.
rename $file, "Done/$file";

Brian




More information about the ubuntu-users mailing list