Perl Basic Script Template

perl Add comments


#!/usr/bin/perl -w

=head1 NAME

$RCSfile$

=head1 VERSION

$Id$

=head1 DESCRIPTION

Text einfuegen.

=head1 AUTHOR

$Author$

=cut

use strict;
use Cwd;
use File::Basename;

##########################################################
# Skriptname: $RCSfile$
# Autor: $Author$
# Beschreibung:
# Parameter:
# Dateien: # DIE VOM SKRIPTE EINGELESEN BZZ: GESCHRIEBEN
# WERDEN!>
# History: $Log$
##########################################################

my $scriptName = basename($0);
my $baseDir = getcwd;
my $cfgFile = $baseDir.'/'.fileparse($scriptName, qr/\.[^.]*/).'.cfg';
my %cfgData;

##########################################################
# Read configuration file into hash
##########################################################

open (FILE,"< $cfgFile") || die "Unable to open: $cfgFile";
while () {
chomp; # no newline
s/#.*//; # no comments
s/^\s+//; # no leading white
s/\s+$//; # no trailing white
next unless length; # anything left?
my ($var, $value) = split(/\s*=\s*/, $_, 2);
$cfgData{$var} = $value;
}
close FILE;

print $cfgData{'param'};

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in