in reply to V basic question about eq

when i try to compare 'you' it matches 'you' & 'you'll' and 'you're' etc
...
i'm using if ($short1 eq $short2).

Okay, you've confused me. The string 'you' does not "match" the string "you'll" using string equality (eq).

All I got out of your post is that you are looking for a way to find strings that contain 'you' might contain "you'd" but must not contain "you'll" or "you're"... is that right? Something like

$short1 =~ /^you(?:'d)?$/;
perhaps?

If not, maybe you could supply us with some code or a better example.

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: V basic question about eq
by Wassercrats (Initiate) on Nov 21, 2003 at 17:41 UTC
    Yeah, that's what threw me. He used single quotes though, so I figured the apostrophy was seen as the end of the string. Don't know if that's possible because I'm a beginner too, but that's how it sounds.
Re: Re: V basic question about eq
by Anonymous Monk on Nov 21, 2003 at 17:40 UTC
    sauoq sorry i didn't make myself clear, i want to match 2 strings exactly but when i use eq it matches you & you'll & you've etc. however i don't want to disregard the ' altogether as i may also have to match you'll at a different time. hope this makes more sense thanks
      regarding my regex:
      it's still not correct.say for american it's matching and outputting american AND american's. i want to disregard the second occurrence unless it matches the string completely?
      regarding eq:
      when i use eq it matches you & you'll & you've
      Are those your theories, or have you actually tested the code and seen that behavior?