Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

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
Replies are listed 'Best First'.
Re^2: Foreach loop
by marinersk (Curate) 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?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2015-10-09 18:33 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (249 votes), past polls