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

[MacPerl] Basic MacPerl Q's for Newbie



Hi Everyone!

I am for all intents and purposes a Perl newbie... and MacPerl listserv
newbie (although I'm casually familiar with a few OOP languages). 

My sense is that MacPerl is not identical to Perl in all of it's syntax.
 Is this correct?  For example, I read a post the other day that
mentioned needing to use Mac "CR" instead of the Unix line end?  I
probably got that wrong... but it sounds important.  Please clarify this
for me if you will.  

My introduction to and first successful MacPerl script grew out of a
need to quickly change the file extensions on over 20,000 files I'm
editing for a website (Applescript was dogging it).  While it worked
great... I couldn't figure out how to maneuver around the Mac Desktop
into different directories, so I had to resort to copying the script to
each directory with a folder I wanted to work on.  The Perl directives
I've learned about so far were turning up "no such file or directory"
errors.  Anyway... here is the code I used.  Perhaps someone could show
me what I'd have to do to access folders on various places on my drive
without having to move the script.  
(I have several partitions... if that has a bearing on this question). 
Thanks for any and all replies!  

#! usr/bin/perl

chdir("jagBoard") || die "nope: $!";

foreach $filename (<*.html>){

$newname = $filename;

$newname =~ s/\./\.s/;

rename($filename,$newname) || die "couldn't rename $filename";

}


-- 
 
 Paul S Gutches
 Multimedia 1.0
 mailto:webmaster@multimedia1.com
 http://www.multimedia1.com
 
 "Where The GAMES Are!"

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch