in reply to Check for 'and'
#!/usr/bin/perl -w
use strict;
use 5.010;
my $str=<<TEXT;
{TAG}
0012310002 and 0012310003
{COUNT}
000000
{COUNT2}
000000 and 100001
TEXT
my %strh = $str=~ /({.+?}|^{}+)/sg;
my @and_contain = grep $strh{$_} =~ /and/,keys %strh;
say join(' and ',@and_contain),' is 1';
Output:
{COUNT2} and {TAG} is 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Check for 'and'
by Anonymous Monk on Aug 13, 2009 at 04:33 UTC |