Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by buckaduck (Chaplain)
on Apr 03, 2002 at 18:56 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://156389]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 20:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found