#!/usr/local/bin/perl -w use strict; use Getopt::Long; my %opt = ( 'debug' => 'g1' ); GetOptions( 'debug=s' => \$opt{'debug'} ) || die ("$!\n"); while ( my ($k , $v) = each %opt ) { printf "%s = %s\n" , $k, $v; }