On Mon, Mar 16, 2009 at 01:39, boll <b...@sonic.net> wrote:
> I'm trying to use the random_image.pl program from the nms-cgi project on
> sourceforge.net.
>
> This line has me baffled:
>        if ( $baseurl !~ m%/$% )
>
>
> I don't understand the function of the percent symbols. I hope someone can
> explain what it's doing.
snip

The matching operator[1] can use delimiters other than /.   This is to
allow cases exactly like this.  If you could not change the delimiter
you would have to say

if ( $baseurl !~ m/\/$/ )

That said, I would normally suggest using one of the bracketing
delimiters[2] instead of one of the non-bracketing delimiters like %:

if ( $baseurl !~ m{/$} )

1. http://perldoc.perl.org/perlop.html#m/PATTERN/msixpogc
2. (), [], {}, or <>

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to