Re: Using multiple test statements

2003-02-27 Thread Pete Emerson
On Fri, 28 Feb 2003, Stefan Lidman wrote: > > Note that you'll match on dudette and joeshmoe ... if you want an exact > > match, you could do: > > > > print "$_\n" if (/^joe|dude$/); > > I guess you ment: > > print "$_\n" if (/^(?:joe|dude)$/); > > Otherwise it matches if it begins with 'joe'

Re: Using multiple test statements

2003-02-27 Thread Stefan Lidman
> Note that you'll match on dudette and joeshmoe ... if you want an exact > match, you could do: > > print "$_\n" if (/^joe|dude$/); I guess you ment: print "$_\n" if (/^(?:joe|dude)$/); Otherwise it matches if it begins with 'joe' or ends with 'dude'. /Stefan -- To unsubscribe, e-mail: [EM

Re: Using multiple test statements

2003-02-27 Thread Pete Emerson
#!/usr/bin/perl -w use strict; my @list = qw(fred joe bob john dude eddie rob dudette joeshmoe); foreach (@list) { print "$_\n" if (/joe|dude/); } Note that you'll match on dudette and joeshmoe ... if you want an exact match, you could do: print "$_\n" if (/^joe|dude$/); On Thu, 2003-02-27 a

RE: Using multiple test statements

2003-02-27 Thread Wagner, David --- Senior Programmer Analyst --- WGO
David O'Dell wrote: > I'm sure there is a way to shorten the way I'm performing this test > statement. > In the script below the test statement is looking for two separate > conditions. > Is there a way to shorten it by not having to specify the variable > twice? Thanks in advance > > #!/usr/loca

Using multiple test statements

2003-02-27 Thread David O'Dell
I'm sure there is a way to shorten the way I'm performing this test statement. In the script below the test statement is looking for two separate conditions. Is there a way to shorten it by not having to specify the variable twice? Thanks in advance #!/usr/local/bin/perl -w @LIST = qw(fred joe