Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Perl vs. Python: Looking at the Code

by buckaduck (Chaplain)
on Apr 03, 2002 at 18:56 UTC ( #156389=note: print w/replies, xml ) Need Help??


in reply to Re: Perl vs. Python: Looking at the Code
in thread Perl vs. Python: Looking at the Code

if listElement in aList: ... do stuff ...
In Perl you gotta do this with grep (or something else like that).

Although we can apparently look forward to the following constructs in Perl 6 (if I read this correctly):

# Do stuff if $list_element is in @a_list if ($list_element =~ @a_list) { ... do stuff ... } # ... OR ... # Loop through a bunch of list elements foreach @list_elements { # Do stuff if the current element is in @a_list when @a_list { ... do stuff ... } # If not in @a_list, what about @other_list ? when @other_list { ... do stuff ... } }

buckaduck

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://156389]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2019-02-17 02:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I use postfix dereferencing ...









    Results (95 votes). Check out past polls.

    Notices?