[boulder.pm] RegExpn Matching, not
Robert L. Harris
Robert.L.Harris at rnd-consulting.com
Wed Feb 9 17:08:03 CST 2000
In reality it's more like this:
while(<CONFIN>) {
($stitle, $title, $source, $match)=split('\#',$_);
$Comics{$stitle}="Conf";
$ComicsTitle{$stitle}=$title;
$ComicsSource{$stitle}='$source';
}
I need to back tick it like this?
Thus spake Scott Longmore (longmore at fsl.noaa.gov):
>
> > Ok,
> > I'm screwing around with my own Web Page generator for some comics I
> > like. Really an excuse to mess with LWP and some RegExpressions. I have
> >
> > The following lines:
> >
> >
> > Defined when reading a config file:
> > $ComicsMatch{userfriendly}= cartoons\/archives\/\w*\/\w*.gif;
> >
> >
> > In the Main script:
> >
> > This Works perfectly
> > $content =~ /(cartoons\/archives\/\w*\/\w*.gif)/;
> >
> > Does Not Work:
> > $content =~ /($ComicsMatch{$key})/;
> >
> > Does Not Work:
> > $TmpMUrl=$ComicsMatch{$key};
> > $content =~ /($TmpMUrl)/;
> >
> >
> > I really need to user iteration #2, or #3 so I can keep a config file
> > instead of hardwiring into the script itself.
> >
> >
> > Robert
>
> Robert,
>
> You need single quotes around your regular expression during
> assignment or it will be evaluated during assignment..i.e.:
>
> $ComicsMatch{userfriendly}='cartoons\/archives\/\w*\/\w*.gif';
>
> This has burned me several times...especially when reading regexps
> from configuration files. One of those little interpreted vs compiled
> language things.
>
> Regards,
> Scott
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~ Scott Longmore - CIRA Research Associate \\\\\\\\\\\\ | ~
> ~ DOC\NOAA\OAR\FSL\MD\E-Team & FSL\RRV Project \\\\\\\\\ - * - ~
> ~ 325 Broadway R/FS6, 2C311 DSRC ~\__n__\ | ~
> ~ Boulder, CO 80303 USA \\\\\\\ ~
> ~ E-mail: longmore at fsl.noaa.gov \MMMM\ ~
> ~ URL: http://www-md.fsl.noaa.gov/~longmore \\\\\ ~
> ~ Phone: (303) 497-6443 Fax: (303) 497-3096 \\\\\Dust\Devil/~
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In the immortal words of Socrates..."I drank what?" -Chris Knight-
:wq!
---------------------------------------------------------------------------
Robert L. Harris | Low quality in a product happens.
Senior System Engineer | That doesn't mean it's right and
at RnD Consulting. | definitely doesn't mean it should
\_ be accepted. Require quality.
http://www.rnd-consulting.com/~nomad
DISCLAIMER:
These are MY OPINIONS ALONE. I speak for no-one else.
FYI:
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
More information about the Boulder-pm
mailing list