#!/usr/bin/perl -w use strict; print "Post Production Report program \n"; print "Enter the Date (yyyymmdd) for the report: \n"; chomp( my $date= ); print "Enter report type (d for detail or s for summary): \n"; chomp( my $type= ); my $reptr = substr( $type, 0, 1 ) eq "d" ? "-detail" : "-summary"; chdir( "tivoli" ) or die "cannot cd to directory"; opendir(DIR, ".") or die "cannot open directory: $!\n"; my @files = grep { /M$date/ } readdir(DIR); closedir DIR; foreach( @files ) { print "Would run: conman reptr $reptr $_\n"; }