Perl Programming basics:

						# variables
my $variable # simple scalar variable definition
my @array # array variable definition
my %hash # hash variable definition

# cycle for all items of array
foreach my $item (@hwarray) {
 $hash{$item}=1; 
 print "Read item: $item\n";
}

# cycle while true
while ($i<10) {
$i++;
}

# print structural variable (requires use Data::Dumper;) :
print Dumper (@array);


# subroutine definition:

sub printwrapper {  # simple custom print 
my $type = shift; 
my $params = @_;
        print @_ if ($type == 0);
        print STDERR @_; #  if ($type == 1);
}

# working with varibles
$variable = 1;
if ($variable) { print "variable : $variable \n"; }
# if $variable is true, then not ($variable) returns empty, undefined value, to avoid this:
$notvariable=((not ($variable))? 1 : 0);

# flushing output
$|++;



for icinga I need these perl modules - 


perl -MCPAN -e shell 
cpan> install Device::SerialPort 
cpan> install Monitoring::Icinga 
for more info see:
 http://perl.about.com/od/packagesmodules/qt/perlcpan.htm