dru145 has asked for the wisdom of the Perl Monks concerning the following question:
I want to match just on the usernames (jsmith.2048) that were added. The code below works, but it enters all the usernames into the @certs array. When I do a print "@certs[0]" I get the following results:Sep 12 17:30:02 nt-ca-na CA(Domain-CA): Certificate name 'jsmith.2048' + added to database. Sep 12 20:09:37 nt-ca-na CA(Domain-CA): Certificate name 'ksmith.2048' + added to database. Sep 12 21:25:30 nt-ca-na CA(Domain-CA): Certificate name 'ssmith.2048' + added to database.
What should I do to place each array into it's own entry?'jsmith.2048''ksmith.2048''ssmith.2048'
#!/usr/bin/perl -w use strict; my $calog = "/var/log/ca/ca.log"; my $line; my @certs; open LOG, "$calog" or die "Can't open $calog: $!\n"; while ($line = <LOG>){ if ($line =~ m/added/) { @certs = $line =~ m!\'[-.\w]+\'!g; print @certs; } #end if } #end while
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array Problem
by blakem (Monsignor) on Sep 14, 2001 at 02:08 UTC | |
|
Re: Array Problem
by dga (Hermit) on Sep 14, 2001 at 02:25 UTC | |
|
Re: Array Problem
by cricket (Acolyte) on Sep 14, 2001 at 04:34 UTC | |
|
Re: Array Problem
by jryan (Vicar) on Sep 14, 2001 at 04:44 UTC | |
by blakem (Monsignor) on Sep 14, 2001 at 04:50 UTC | |
|
Re: Array Problem
by hopes (Friar) on Sep 14, 2001 at 09:59 UTC |