newbie help with a perl script
Hello,
I'm in need of some help with this script I've written. Any assistance in getting it working would be much appreciated! I want the script to read all filename arguments and do the following to them: 1) Match something in the current file that looks like a website name and store it in a variable. I know there's only one unique website name per file. Should look like $sitename = www.sitename.com 2) Add several lines to the the current file (preferably, but not necessarily, the end-of-file) using regex substitute, including the $sitename var. Here is the script with comments: Code:
#!/usr/bin/perl -w |
Quote:
|
Sorry for the confusion. I've cut out all the non-essentials just to show what I'm trying to do. To reiterate, I just want to batch edit a bunch of files: 1) match the sitename and store it in a variable, then 2) add new lines with the URL provided from $sitename to maintain relativity.
Code:
#!/usr/bin/perl -w |
How about this:
Code:
#!/usr/bin/perl -w |
Don't use '&' to call a sub.
(there are occasional reasons to do so, eg passing a a reference to a sub, but they don't apply here) |
Quote:
Regards, -J |
Quote:
Quote:
Code:
perldoc perlstyle
|
tyvm for the critique.
|
BTW, if you haven't already got this, bookmark it: http://perldoc.perl.org/ :)
|
All times are GMT -5. The time now is 11:57 AM. |