On 3/1/07, oryann9 <[EMAIL PROTECTED]> wrote:
snip
> perl -ne 'print unless $h{(split/:/)[0]}++'
This is creating a anonymous hash, correct?
snip
No, the hash is named %h. The proper way to read $h{(split/:/)[0]}++
is "Increment the value whose key in %h is the first element of $_
when split
oryann9 wrote:
> --- Chas Owens <[EMAIL PROTECTED]> wrote:
>>
>>This should work
>>
>>perl -ne 'print unless $h{(split/:/)[0]}++'
>
> This is creating a anonymous hash, correct?
No, incorrect. The hash is named %h.
John
--
Perl isn't a toolbox, but a small machine shop where you can special-o
--- Chris Charley <[EMAIL PROTECTED]> wrote:
>
> > This is creating a anonymous hash, correct?
>
> This is saying
> print unless the first field has been seen before
>
> which is what he wants his code to do.
>
> $h is a good short notation - but using %seen
> instead of %h may make it clearer
--- Chas Owens <[EMAIL PROTECTED]> wrote:
> On 2/27/07, Keenan, Greg John (Greg)** CTR **
> <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I have to combine several Unix password files and
> remove any duplicate
> > accounts - putting this into LDAP.
> >
> > I have the following code that will remove
Keenan, Greg John (Greg)** CTR ** wrote:
Hi,
I have to combine several Unix password files and remove any duplicate
accounts - putting this into LDAP.
I have the following code that will remove any duplicate whole lines but
I need to remove lines only if the first field of the password file is
On 2/27/07, Keenan, Greg John (Greg)** CTR **
<[EMAIL PROTECTED]> wrote:
Hi,
I have to combine several Unix password files and remove any duplicate
accounts - putting this into LDAP.
I have the following code that will remove any duplicate whole lines but
I need to remove lines only if the firs
-Original Message-
>From: "Keenan, Greg John (Greg)** CTR **" <[EMAIL PROTECTED]>
>Sent: Feb 28, 2007 12:39 PM
>To: beginners@perl.org
>Subject: remove line if field one is duplicate
>
>Hi,
>
>I have to combine several Unix password files and remove any duplicate
>accounts - putting this