Select / Case in perl

B

Bill H

I did a search of the group and found many messages about a select /
case function in Perl and found references to perldoc -f case and
perldoc -f switch - but neither of these are found under activestate
v5.8's perldoc. Can someone point me to some reference on how to
simulate this structure in perl so I dont have to use endless if's?

Bill H
 
G

Gunnar Hjalmarsson

Bill said:
I did a search of the group and found many messages about a select /
case function in Perl and found references to perldoc -f case and
perldoc -f switch - but neither of these are found under activestate
v5.8's perldoc. Can someone point me to some reference on how to
simulate this structure in perl so I dont have to use endless if's?

perldoc Switch
 
B

Bill H

I did a search of the group and found many messages about a select /
case function in Perl and found references to perldoc -f case and
perldoc -f switch - but neither of these are found under activestate
v5.8's perldoc. Can someone point me to some reference on how to
simulate this structure in perl so I dont have to use endless if's?

Bill H

Never mind - someone must have been reading my mind and posted a FAQ
yesterday about it - not sure why it didnt show up when I searched the
group in google groups though.

Bill H
 
A

A. Sinan Unur

Please don't quote sigs.
I have read under various postings that "Switch" is bad and to not use
it.

I will concur with that. In most cases, using a hash to look up actions
or the plain old cascading if-elsif blocks are quite straightforward.
Switch.pm is a source filter (AFAIK) and therefore can be fooled by
oddities in the layout of the source etc.

Sinan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,434
Messages
2,571,689
Members
48,796
Latest member
Greg L.

Latest Threads

Top