develooper Front page | perl.beginners | Postings from February 2002

Does Perl have "Case" Statements?

Thread Next
From:
Chris
Date:
February 28, 2002 13:45
Subject:
Does Perl have "Case" Statements?
Message ID:
3C7EA426.7040203@candp-ent.com
I have been looking in the Learning Perl book, and cannot find it.

I am sure that it is just a terminology thing.

In VB {Yeah the old VB again :P) I could do:

Select Case $Junk
     Case 1
        Do Something
     Case 2
        Do Something
     Case 3
        Do Something
     Case 4
        Do Something
End Select

Does Perl have something similar to where I do not have to have one
humongous IF statement?

I have a file I have to read in, and there are 2 fields I have to look 
at.  In those two fields, one is a password, and I have to display
the decrypted password to the admin.

Reading the file is not hard.

Getting the proper fields is not hard.

But the password is based on something "a little different" so it isn't just
pass the decrypt to it...  I have the workaround I was given to 
determine it, but that means that I have to read it and look
for the matching string.

Thus a Case Statement, IMHO, would be the best possible solution - with
my current knowledge...

:)

TIA!!

Chris


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About