#!/usr/bin/perl -w use strict; unless ($ARGV[0] eq '-lc' || $ARGV[0] eq '-uc' ){ die "usage: lcuc [-uc | -lc] file\n"; } my $op = substr(shift @ARGV, 1, 2); while(<>){ no strict 'refs'; print &{$op}($_) } sub lc{ lc shift } sub uc{ uc shift }