convenientstore has asked for the wisdom of the Perl Monks concerning the following question:
When I run it I get#!/usr/bin/perl -w use strict; my $user; my $tty; my $count; my @where; my %count = (); my %where = (); foreach $_ (`who`) { ($user,$tty) = /(\S+)\s+(\S+)/; $count{$user}++; $where{$user}{$tty}++; } foreach (sort keys %count) { if ($count{$_} == 1) { print "user $_ is ONLY logged in at one place "; print $where->{$_}; } else { print "user $_ is logged in at: "; @where = sort keys %{$where{$_}}; print "@where\n"; } } ~
~/script/perl/temp@myserver >./perl.tty1 Global symbol "$where" requires explicit package name at ./perl.tty1 l +ine 22. Execution of ./perl.tty1 aborted due to compilation errors. ~/script/perl/temp@myserver >
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: reference question
by Joost (Canon) on Jul 28, 2007 at 22:53 UTC | |
by convenientstore (Pilgrim) on Jul 28, 2007 at 23:10 UTC | |
|
Re: reference question
by wind (Priest) on Jul 29, 2007 at 00:31 UTC | |
by convenientstore (Pilgrim) on Jul 29, 2007 at 03:15 UTC | |
by wind (Priest) on Jul 29, 2007 at 04:20 UTC | |
by convenientstore (Pilgrim) on Jul 29, 2007 at 01:35 UTC | |
|
Re: reference question
by Cabrion (Friar) on Jul 28, 2007 at 22:55 UTC |