On 06/26/12 14:31, Cal Dershowitz wrote:
> I've been using perl scripts to mechanize oft-repeated tasks for my
> website. I tell my friend what I'm doing and he says, "oh you need
> HTML::Template."
Have your friend help you first and do we need to know what your friend
says??..
>What I hope to do with this thread is re-write it with
> modules, as well as providing a utility to make my choice of filenames
> less obvious, but still within the organizational scheme that will be
> this site.
>
> First, though, I want to go back just a bit and clear up my last few
> difficulties with what has gone before:
First though, this has nothing to do with the Subject!!!!!!!! Folks
who know a lot about HTML::Template just wasted their time reading
your post.
>
> Q1) I continue to have difficulties combining the syntax of lexical
> variables and RE's:
> my $word = "ceiling";
> my @matching = map /ceiling_(\d+)\.html/, @remote_files;
> my $html_file = "ceiling_$newnum1.html";
>
> How would I write those last 2 lines of code with $word instead of
> "ceiling?"
This is all you needed to post. Code showing the issue and
your question.
Use ${word} where you want it to occur, instead of $word.
my $html_file = "${word}_$newnum1.html";
Since you could have a variable $word_, you need to show
that you really only want it to use $word.
>
> Q2) There's a huge amount of reading out there on this topic, which I'm
> grateful for. Anyone have a link that they think is particularly
> effective at studying up on this?
>
> Q3) This one's a little out there. Right after the unlink statement up
> there, or better yet, just before the close statement, what would happen
> if you wrote:
>
> open( my $gh, '>', ceiling1.pl) or die("Can't open ceiling1.pl for
> writing: $!");
No need for () there..
die "Can't open ceiling.pl for writing: $!"
>
> where the name of the script itself is ceiling1.pl,and then attempted to
> write from $gh to $fh linewise? I know it's illegal in C, so I don't
> want to just try it and see what happens.
Bye bye ceiling.pl..
Think about it.....
What do you think '>' will do?
Why do you think you want do to that?
Actually, I'm not sure what you're asking.. How do you 'write from $gh
to $fh'?
You can answer this yourself. Be sure to have a copy of ceiling.pl
first though.
> It's too much work cleaning up...
Do you think anyone will continue reading your post if put in
more garbage???..
|