View Single Post
  #3   (View Single Post)  
Old 18th November 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

The '=>' separates the hash key from the hash value. It is a more visual appealing replacement then the ',' which also can be used for this purpose
Code:
 %shell = (
         Theo  => '/bin/sh',
         Linus =>  '/bin/bash' ) ;

print "\nTheo's shell : $shell{'Theo'} " ;
print "\nLinus' shell : $shell{'Linus'} " ; 

$ perl hash-shell

Theo's shell : /bin/sh 
Linus' shell : /bin/bash
Another example but now using a comma
Code:
%os = ( 
        'Theo',  'OpenBSD',
        'Linus', 'Linux'
);

print "\nTheo's OS : $os{'Theo'} " ;
print "\nLinus' OS : $os{'Linus'} " ;

$perl hash-os

Theo's OS : OpenBSD 
Linus' OS : Linux
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote