niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » Perl
How to find out if a certain value is in a list?
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
Author Message
TN
*nix forums beginner


Joined: 25 May 2005
Posts: 4

PostPosted: Fri Jul 21, 2006 1:41 pm    Post subject: Re: How to find out if a certain value is in a list? Reply with quote

Great,
that gave me a good solution.
Thanks,
-TN

"Tad McClellan" <tadmc@augustmail.com> kirjoitti
viestissä:slrnebure8.drq.tadmc@magna.augustmail.com...
Quote:
TN <tjpn@not_spam.surfeu.fi> wrote:

what would be the shortest (or best...) way to find out if a certain
value
is in the list like in the code here:
^^^^
^^^^

perldoc -q list

How can I tell whether a certain element is contained in a list or
array?


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
Back to top
Tad McClellan
*nix forums Guru


Joined: 09 Mar 2005
Posts: 1647

PostPosted: Thu Jul 20, 2006 11:49 am    Post subject: Re: How to find out if a certain value is in a list? Reply with quote

TN <tjpn@not_spam.surfeu.fi> wrote:

Quote:
what would be the shortest (or best...) way to find out if a certain value
is in the list like in the code here:
^^^^

^^^^

perldoc -q list

How can I tell whether a certain element is contained in a list or
array?


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
Back to top
anno4000@radom.zrz.tu-ber
*nix forums beginner


Joined: 05 Jul 2006
Posts: 40

PostPosted: Thu Jul 20, 2006 9:21 am    Post subject: Re: How to find out if a certain value is in a list? Reply with quote

TN <tjpn@not_spam.surfeu.fi> wrote in comp.lang.perl.misc:
Quote:
Hi there,
what would be the shortest (or best...) way to find out if a certain value
is in the list like in the code here:

perldoc -f grep

Anno
Back to top
TN
*nix forums beginner


Joined: 25 May 2005
Posts: 4

PostPosted: Thu Jul 20, 2006 9:07 am    Post subject: How to find out if a certain value is in a list? Reply with quote

Hi there,
what would be the shortest (or best...) way to find out if a certain value
is in the list like in the code here:

my @resultarray = &somefunc("case"); # returns a list (1,3,5,7,9) in this
case
# now I need to know whether 7 is in the @resultarray or not
if (...) {
# 7 was in the @resultarray
} else {
# 7 was not in the @resultarray
}


Greetings,
TN
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
The time now is Thu Dec 04, 2008 1:41 am | All times are GMT
navigation Forum index » Programming » Perl
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts List History Backup Gladiator IBM DB2 3 Fri Jul 21, 2006 8:21 am
No new posts Testing my Black List Marc Perkel Exim 6 Fri Jul 21, 2006 5:57 am
No new posts Your Opinion about how to set up a DNS list Marc Perkel Exim 0 Fri Jul 21, 2006 2:18 am
No new posts FAQ 4.41 How can I remove duplicate elements from a list ... PerlFAQ Server Perl 0 Fri Jul 21, 2006 1:03 am
No new posts Flash device can't find in kernel and redboot Kevin embedded 1 Thu Jul 20, 2006 10:04 am

Cell Phones | Synchronization fast and easy | Personal Loans | Venta chalets Denia | Shares
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1453s ][ Queries: 20 (0.0692s) ][ GZIP on - Debug on ]