in reply to Re^2: Saving Results of a while loop
in thread Saving Results of a while loop

Well, I have to say no and no

  1. qr// works fine with \b, e.g.
    my $string = q/This is a test./; my $regex1 = qr(\bis); my $regex2 = qr(is); print $string =~ /$regex1/g, "\n"; print $string =~ /$regex2/g, "\n"; # prints is isis
  2. Your second part
    $ip = qr("192.168.3.5");
    matches e.g. "192 16833!5" but not what was being looked for. Did you maybe want to use the quotemeta function?? Then
    my $ip = "192.168.3.5"; $ip = quotemeta $ip;
    would be the way to go.

-- Hofmator

Replies are listed 'Best First'.
Re^4: Saving Results of a while loop
by tadman (Prior) on Aug 01, 2001 at 20:10 UTC
    quotemeta would be the one. Looks like I got a little carried away there. In some of my programs I've aliased "qm" to be "quotemeta", which would account for some of the confusion on my part. The rest I can just chalk up to plain old fashioned ignorance.

    Thanks for pointing this out.