CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
$measure

 



kumar
Novice

Jun 5, 2009, 12:53 AM

Post #1 of 5 (553 views)
$measure Can't Post

Which of the following values of $measure will make it into the correct measures section in the code below: P3, D7, DD, w1, IM, I9, I4, J1

if ($measure =~ /A[1-3]/ ||
$measure =~ /I[1-8]/ ||
$measure =~ /D[0-9]/ ||
$measure =~ /P[1-2]/ ||
$measure =~ /C[1-2]/ ||
$measure =~ /W[1-3]/ ||
$measure =~ /O[1-4]/)
{ # do something here; }


Thanks in Advance


vikas.deep
User

Jun 5, 2009, 1:51 AM

Post #2 of 5 (549 views)
Re: [kumar] $measure [In reply to] Can't Post

Dear you,

The following should make you happy


Code
use strict; 
use warnings;
my $measure = 'DD';
#or any alphanumeric variable where alpha-character #may be in upper or lower case

if ($measure =~ /[A-Z a-z 0-9]/ )
{print "I am a beginner in Perl";}

-For all my suggestions " I am sure someone else can do it in a better or elegant manner!"


vikas.deep
User

Jun 5, 2009, 2:07 AM

Post #3 of 5 (546 views)
Re: [kumar] $measure [In reply to] Can't Post

In your code only D7 and I4 shall match
-For all my suggestions " I am sure someone else can do it in a better or elegant manner!"


kumar
Novice

Jun 5, 2009, 6:40 AM

Post #4 of 5 (539 views)
Re: [vikas.deep] $measure [In reply to] Can't Post

nice code you have written.

Thank you so much Vikas.


KevinR
Veteran


Jun 5, 2009, 2:06 PM

Post #5 of 5 (530 views)
Re: [kumar] $measure [In reply to] Can't Post


In Reply To
Which of the following values of $measure will make it into the correct measures section in the code below: P3, D7, DD, w1, IM, I9, I4, J1

if ($measure =~ /A[1-3]/ ||
$measure =~ /I[1-8]/ ||
$measure =~ /D[0-9]/ ||
$measure =~ /P[1-2]/ ||
$measure =~ /C[1-2]/ ||
$measure =~ /W[1-3]/ ||
$measure =~ /O[1-4]/)
{ # do something here; }


Thanks in Advance


cheating
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives