http://qs321.pair.com?node_id=624640


in reply to A wrapper script for tmpwatch in Linux written in Perl

system "/usr/bin/ssh $system->{host}#this part doesn't work, o+nly brings back reference";
of course! $system->{host} is a hash reference! you need
$system->{host}->{$host}
to access the hostname.

Replies are listed 'Best First'.
Re^2: A wrapper script for tmpwatch in Linux written in Perl
by wishartz (Beadle) on Jul 03, 2007 at 12:14 UTC
    I tried that and it doesn't work because it only enters that part of the if condition, if $host (the machine you are logged into at that time, which I have set with $host =`hostname`) doesn't equal $system->{host}
    if ( not $system->{host}{$host})
    I need to be able to dreference $system->{host} so it will come up with the name of the hostname, but I don't think that will work because the hostname is the key rather than the value. I think I might have to change my hash. Thanks for your help anyway.