#!/bin/sh
#... intervening code ...
export CountDataLines = `perl -e 'while(<>){/^\s* or $notXML++;} print $notXML;' < $FileName`
####
my %gdd; Init( \%gdd)
##
##
sub Init
#example of using a reference to a unique global dictionary
my $gref = shift;
open my $lh, ">>$ENV{ LOGFILE}" or Die( "$!: $ENV{ LOGFILE }" );
$gref -> { FH }{ LOGFILE } = $lh;
#...
# example of initialising specific hash levels of a gdd using a locally scoped reference:
for my $streamType qq( GSM SMS MMS ESP GPRS ) {
$gref -> { ST }{ $streamType }{ BILLABLE }
= ( $streamType eq 'ESP' ) ? 0 : 1;
$gref -> { ST }{ $streamType }{ BYDURATION }
= ( $streamType eq 'GSM' ) ? 1 : 0;
$gref -> { ST }{ $streamType }{ BYVOLUME }
= ( $streamType eq 'MMS' ) ? 1
: ( $streamType eq 'GPRS ) ? 1 : 0;
}
}
# example of using the FH for a logfile somewhere else in codeland...
sub SomewhereSomeModule{
my $gref = shift;
#...
Log( $gref, 'description of functional phase' );
#...
}
sub Log{
my ($gref, $msg ) = @_;
my $lh = $gref -> { FH }{ LOGFILE };
print $lh MyTimeStamp() . ": $msg\n";
}