Gossamer Forum
Home : General : Perl Programming :

switch??

Quote Reply
switch??
just want to know is there a switch in perl like in C/java?
Quote Reply
Re: [0069] switch?? In reply to
What kind of switches? Like here;

http://perldoc.com/...unc.html#DESCRIPTION

... with the -w etc switches you can use?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [0069] switch?? In reply to
Do you mean like this in VB?

Code:
Select Case (Variable)
case "xyz"
MsgBox "Hi"
case "abc"
MsgBox "Bye"
End Select
Quote Reply
Re: [0069] switch?? In reply to
Nope, no official syntax, but a lot of ways to do it. See:

http://www.perldoc.com/...h-or-case-statement-

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] switch?? In reply to
Oh, and if you really want some powerful switch handling, there's always:

http://search.cpan.org/...witch-2.09/Switch.pm

(but it's slow as it actually rewrites your code on the fly -- but very cool).

Cheers,

Alex
--
Gossamer Threads Inc.