Jim Canon wrote:
> Hi,
Hello,
> This is my first question, I appreciate any information you provide. I want
> to compare the numbers after : in @jn to the numbers after job in @job1 and
> @job2.
>
> [ snip ]
>
> I want to put what is missing in @jn compared to @job1 and @job2 in
> @jobMissing :
>
> job572
> job873
> job2223
>
> I want to put what is missing in @job1 and @job2 compared to @jn in
> @jnMissing :
> job111
> job321
Don't you mean:
JN.2007:111
JN.2007.321
How about this:
my %jn_num = map { /(\d+)$/, undef } @jn;
my %job_num = map { /(\d+)$/, undef } @job1, @job2;
my %seen;
my @jobMissing = map /(\d+)$/ && exists $jn_num{ $1 } ? () : $seen{ $1 }++ ?
() : $_, @job1, @job2;
%seen = ();
my @jnMissing = map /(\d+)$/ && exists $job_num{ $1 } ? () : $seen{ $1 }++ ?
() : $_, @jn;
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/