#! /usr/local/bin/perl -w use strict; my( $switch, $thing ); $switch = shift; if( $switch and $switch eq "-g" ) { $thing = shift || 'world'; } else { $thing = $switch || shift || 'world'; $switch = undef if $switch; } print $switch ? 'Goodbye' : 'Hello', ", $thing\n";