[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Rename me Perl



mark@cheers.jsc.nasa.gov (Mark Manning/Metrica) wrote
>I've found an interesting error which might or might not be
>known about.  The RENAME command, if you use it, and if you
>put the file names in double quotes, and then leave off the
>semicolon at the end, will not generate an error (at least
>it didn't for me).  Instead, Perl will just throw the
>subroutine out.  Example:
>
>#!perl
>
>	&renameME;
>	exit( 0 );
>
>sub renameME
>{
>	rename "myFriend.dat", "myFiend.dat"
>}
>
>I came across this in a set of subroutines.  All but the
>routine with the rename in it could be found and used.
>This one couldn't be.  The original routines were in
>separte files and not all together.  So if the above works
>and/or gives and error try separating the subroutine from
>the main program and put in a "do 'renameME.pl';".  That
>should show the error.  :-)

Hello,
      Which version of Perl are you using? I ran this code and it seemed to
work
as I expected it to (both as a single file, and as a pair of files).

I'm using the MacPerl appl version 513r2.

My understanding of the semi-colon as terminator is that it is optional in
blocks with single statements (though recommended since you may later add lines
to the block). I'm ready to be corrected (ooh yes please!!), though!

Bob


________________________________________________________________
          Bob Wilkinson, Perl Programmer, Pindar plc
Tel: +44 (0)1904 613040    Email: B.Wilkinson@pindar.co.uk
Fax: +44 (0)1904 613110    URL: http://www.connection.co.uk/bob
________________________________________________________________
  I don't speak for my employer - er, they made me say that..
________________________________________________________________