Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Easy Scalar Matching Problem

Easy Scalar Matching Problem

Easy Scalar Matching Problem

But not easy to me.  What do I need to do to match all of the occurrences of a name of a month?  This is what I've got, but it doesn't work this way, using qw, whitespace instead of ¦, or as an array.  I don't get it.

if ($token =~/$months/)

{do something}


RE: Easy Scalar Matching Problem

Your syntax make good sense.  Strange :^\  When I copy the code above and run on my box, I have to change the pipe chars from HEX 'A6' to HEX '7C' to get it to work.   

This works  - copied from my box
$token = 'june';
if ($token =~ /$months/) { print "Matched"; }

I notice that the pipes change back to HEX 'A6' when this POST is previewed.

keep the rudder amid ship and beware the odd typo

RE: Easy Scalar Matching Problem

GoBoat:  Thanks much yr reply.  It still doesn't work on my Windows machine.  What is the English description of HEX7C?  I tried the same code using commas and whitespace, with same unsuccessful result.  And, is there another way to do this?  It does seem strange, doesn't it?


RE: Easy Scalar Matching Problem

I am having some real trouble believing that the pipe char could be the problem here.....we must be missing something.  Maybe someone else has some ideas....

Anyway, in english...
HEX 'A6' is a broken vertical bar.  - Decimal value '166'
HEX '7C' is a solid vertical bar.  - Decimal value '124'

When I use "shift-\"(below backspace and above enter - on my keyboards), I get a pipe symbol (verticle bar) with a hex value of '7C'.  That character works as the 'OR' operator.  
This is true for the WinNT 4.0 box and for my Sun Ultra running SunOS.

keep the rudder amid ship and beware the odd typo

RE: Easy Scalar Matching Problem

I have perlbuilder and running win nt. I just tried out the code and it works. Here is what my code is:


$token = 'march';

if ($token =~/$months/) {print "yes";}

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close