Is there an elegant way to make sure that a string contains a list of
strings, but not necessarily in any particular order? Here's how I'm doing
it:
#!/usr/bin/perl -w
use strict;
my @strings=qw(onetwothree threeonetwo onetwonope);
my @matches=qw(one two three);
foreach my $string (@strings) {
"Pete Emerson" <[EMAIL PROTECTED]> wrote in message:
> Is there an elegant way to make sure that a string contains a list of
> strings, but not necessarily in any particular order? Here's how I'm doing
> it:
>
> #!/usr/bin/perl -w
>
> use strict;
> my @strings=qw(onetwothree threeonetwo onetwonope
Pete Emerson wrote:
> Is there an elegant way to make sure that a string contains a list of
> strings, but not necessarily in any particular order? Here's how I'm
> doing
> it:
>
> #!/usr/bin/perl -w
>
> use strict;
> my @strings=qw(onetwothree threeonetwo onetwonope);
> my @matches=qw(one two thre
Thanks for your code, I've gotta look up \Q to make sure I understand
what's happening, but it looks great. I'm still parsing your comments to
make sure I understand everything.
I'm not quite sure what you meant about side effects from my conditional
being frowned upon...how else do you use the ()
Pete Emerson wrote:
> Thanks for your code, I've gotta look up \Q to make sure I understand
> what's happening, but it looks great. I'm still parsing your comments
> to make sure I understand everything.
Within a string, \Q escapes (with '\') all following non-word characters
(a-z, A-Z, 0-9 and un
Mar 16, 2003 at 5:08pm from Rob Dixon:
RD> (print 'abc') + ($success = 0) + (last);
Rob, thanks, this example helps drive the point home. Would you also argue
that
open INFILE, $file || die "Can't open $file: $!";
should really be written as
die "Can't open $file: $!" if (!open INFIL
Pete Emerson wrote:
> Mar 16, 2003 at 5:08pm from Rob Dixon:
>
> RD> (print 'abc') + ($success = 0) + (last);
>
> Rob, thanks, this example helps drive the point home. Would you also argue
> that
>
> open INFILE, $file || die "Can't open $file: $!";
>
> should really be written as
>
> die
Pete Emerson wrote:
> Mar 16, 2003 at 5:08pm from Rob Dixon:
>
> RD> (print 'abc') + ($success = 0) + (last);
>
> Rob, thanks, this example helps drive the point home. Would you also argue
> that
>
> open INFILE, $file || die "Can't open $file: $!";
>
> should really be written as
>
>
Pete Emerson wrote:
>
> Mar 16, 2003 at 5:08pm from Rob Dixon:
>
> RD> (print 'abc') + ($success = 0) + (last);
>
> Rob, thanks, this example helps drive the point home. Would you also argue
> that
>
> open INFILE, $file || die "Can't open $file: $!";
>
> should really be written as
>