#!/usr/bin/perl -w use warnings; use strict; my %count; while (<DATA>) { chomp; my ($x,$y) = split /\s/; ($x,$y) = ($y,$x) if ($x gt $y); $count{"$x $y"}++; } foreach (sort keys %count) { print "people with $_: $count{$_}\n"; } __DATA__ cat dog cat fish pig dog horse fish pig fish dog fish fish cat
In reply to Re^3: help with 2D arrays with perl requested
by ruzam
in thread help with 2D arrays with perl requested
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |