Hi [EMAIL PROTECTED],

I have code snippet, which gave me statistics of lines in file:

foreach my $item (@list) {
    chomp($item);
    if ($seen{$item}) { 
        $seen{$item}++;
    } else { 
        $seen{$item} = 1; 
    }
}

this is quite simple, so I rewrite that as:

foreach my $item (@list) {
    chomp($item);
    $seen{$item} ? $seen{$item}++ : $seen{$item} = 1;
}

and perl says:

Can't modify postincrement (++) in scalar assignment ...

What I am doing bad ?

--

 --. ,--  ,-     ICQ: 7552083      \|||/    `//EB: www.2ge.us
,--' |  - |--    IRC: [2ge]        (. .)    ,\\SN: 2ge!2ge_us
`====+==+=+===~  ~=============-o00-(_)-00o-================~
"It wasn't me who misplaced the Deltavid asteroid belt." - Q
 




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to