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:
Simplfy

 



adiolord
Novice

Feb 9, 2009, 4:37 PM

Post #1 of 6 (697 views)
Simplfy Can't Post

if( $selec eq 'a' or $selec eq 'A' ) {
print "\n Ascending!\n" ;
exit ;
}

looking to combine the 1st line maybe pattern matching


FishMonger
Veteran / Moderator

Feb 9, 2009, 5:45 PM

Post #2 of 6 (693 views)
Re: [adiolord] Simplfy [In reply to] Can't Post

if( $selec =~ /^a$/i ) {


adiolord
Novice

Feb 9, 2009, 5:56 PM

Post #3 of 6 (687 views)
Re: [FishMonger] Simplfy [In reply to] Can't Post

if( $selec =~ /^a$/i ) {



correct me if I'm wrong but would I not need brackets around the a --- [a]?


FishMonger
Veteran / Moderator

Feb 9, 2009, 6:26 PM

Post #4 of 6 (685 views)
Re: [adiolord] Simplfy [In reply to] Can't Post

No. The i modifier makes it case independent.

These are effectively the same.

if( $selec =~ /^a$/i ) {

if( $selec =~ /^[aA]$/ ) {


adiolord
Novice

Feb 9, 2009, 6:43 PM

Post #5 of 6 (681 views)
Re: [FishMonger] Simplfy [In reply to] Can't Post

ok yes that was the case, I took the brackets out I had...

so now that I can decipher choice being ascending or descending, I have to create an array that stores the numbers 0 - 254, and then print them in a chart like format to the screen , this should be scary.. and actually output the ASCII equivalent symbol.


KevinR
Veteran


Feb 9, 2009, 7:25 PM

Post #6 of 6 (678 views)
Re: [adiolord] Simplfy [In reply to] Can't Post

Why did you start a new thread?
-------------------------------------------------

 
 


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

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