Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Foreach loop

by Bloodnok (Vicar)
on Sep 27, 2013 at 10:42 UTC ( #1055961=note: print w/ replies, xml ) Need Help??


in reply to Foreach loop

If you are going to use a for loop, I'd use something along the lines of ...

my $keys = "5 10 14 16 17 20 25 26 38 1 42 + 47 54"; my $substr = '1'; print "\nExist" if $_ eq $substr for split /\s+/, $keys;
Having said that, the OP has the whiff of homework

A user level that continues to overstate my experience :-))


Comment on Re: Foreach loop
Download Code
Re^2: Foreach loop
by marinersk (Chaplain) on Sep 27, 2013 at 23:56 UTC
    It might have the whiff of homework, but at least the OP posted functional code. It leaves us able to prod in the right direction without necessarily giving the whole house away.

    But yeah, some care was warranted. :-)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2014-09-19 11:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (135 votes), past polls