This is what you can use.
SWITCH: for ($start) { #start could be a, b, c, d
(/^a/) && do { $check = 1;
last SWITCH;
};
(/^b/) && do {
last SWITCH;
};
(/^c/) && do {
last SWITCH;
};
(/^d/) && do {
last SWITCH;
};
(/^e/) && do {
last SWITCH;
};
# default
# do soemething else
$check = 1;
}
Thanks,
Ashish Tiwari
Integrated Decisions & Systems
_____
_______________Reply Separator____________________
Subject: Does Perl have "Case" Statements?
Author: Chris <[EMAIL PROTECTED]>
Date: 2/28/02 3:41 PM
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
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Received: from listserv.ActiveState.com ([209.17.183.249]) by
mailserver.mail1.com with SMTP
(IMA Internet Exchange 3.11) id 000C2584; Thu, 28 Feb 2002 13:47:55 -0800
Received: (qmail 11261 invoked from network); 28 Feb 2002 21:47:16 -0000
Received: from localhost (HELO shot.ActiveState.com) (127.0.0.1)
by localhost with SMTP; 28 Feb 2002 21:47:16 -0000
Return-Path: <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
Received: (qmail 10797 invoked from network); 28 Feb 2002 21:46:07 -0000
Received: from espresso.activestate.com (HELO smtp1.ActiveState.com)
(192.168.2.150)
by listserv1.activestate.com with SMTP; 28 Feb 2002 21:46:07 -0000
Received: from chrisa (cs666837-200.austin.rr.com [66.68.37.200])
by smtp1.ActiveState.com (8.11.6/8.11.6) with ESMTP id g1SLk0v08783
for <[EMAIL PROTECTED]>; Thu, 28 Feb 2002 13:46:00
-0800
Received: from [207.115.54.47] by chrisa
(ArGoSoft Mail Server Pro, Version 1.70 (1.7.0.4)); Thu, 28 Feb 2002 15:45:47
-0600
Message-ID: <[EMAIL PROTECTED]>
From: Chris <[EMAIL PROTECTED]>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.7+)
Gecko/20020120
X-Accept-Language: en-us
MIME-Version: 1.0
Newsgroups: perl.beginners
To: Win32 Perl Users <[EMAIL PROTECTED]>
Subject: Does Perl have "Case" Statements?
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-PerlMx-Spam: Gauge=I, Probability=1%, Report="SUBJ_ENDS_IN_Q_MARK"
X-Filtered-By: PerlMx makes it fast and easy. See
http://www.ActiveState.com/Products/PerlMx/Header
Sender: [EMAIL PROTECTED]
Errors-To: [EMAIL PROTECTED]
X-BeenThere: [EMAIL PROTECTED]
X-Mailman-Version: 2.0.5
Precedence: bulk
List-Help:
<mailto:[EMAIL PROTECTED]?subject=help>
List-Post: <mailto:[EMAIL PROTECTED]>
List-Subscribe:
<http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users>,
<mailto:[EMAIL PROTECTED]?subject=subscribe>
List-Id: Discussions relating to ActivePerl on Win32 platforms
<perl-win32-users.listserv.ActiveState.com>
List-Unsubscribe:
<http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users>,
<mailto:[EMAIL PROTECTED]?subject=unsubscrib
e>
List-Archive: <http://mailarchive.activestate.com/browse/perl-win32-users/>
Date: Thu, 28 Feb 2002 15:41:58 -0600
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs