Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does the following mean?

Status
Not open for further replies.

sdslrn123

Technical User
Jan 17, 2006
78
GB

print FILE if ++$count{$_} < 2;

Does anyone know what is being printed to the filehandle FILE?
 
Sorry, my fault, I am just trying to figure out what the whole line means?
 
It prints the value of $_ to FILE, if a hash with $_ as its key has a value that is greater than 2, after adding 1 to its current value.
 
er, less than 2 (was a bit dyslexic with the inequality sign there)
 
In 'longhand' it would be:
Code:
$count{$_} = $count{$_} + 1;
if ( $count{$_} < 2 ) {
  print FILE $_;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top