Hello
I have a script that is (at one point) reading through a file. The file
is processed line by line and each line split into an array like so:
while (<$TESTFILE>)
{
my $cur_line=$_;
chomp ($cur_line);
my @split_line = split( /$t_delim/, $cur_line );
# In a number of places, I have code that looks like the following.
my $default_type;
if( $split_line[0] eq "DEFAULT_INPUT" )
{
$default_type = "INPUT";
}
if ( $split_line[0] eq "DEFAULT_OUTPUT" )
{
$default_type = "OUTPUT";
}
# processing continues...
# more stuff here
# blah blah blah
# etc. etc.
}
This works OK, but I'm trying to avoid declaring variables seperately
from assigning them (wherever possible), and trying to keep the size of
the script down without losing human legibility.
Is there a neater/cleverer way of doing this?
Cheers
Andy Taylor
Andrew Taylor | Capgemini | Telford
ASPIRE Data Warehouse Support
T : +44 (0)1952 430684 | www.capgemini.com <http://www.capgemini.com/>
Capgemini is a trading name used by the Capgemini Group of companies which
includes Capgemini UK plc, a company registered in England and Wales (number
943935) whose registered office is at No. 1 Forge End, Woking, Surrey, GU21 6DB.
This message contains information that may be privileged or confidential and is
the property of the Capgemini Group. It is intended only for the person to whom
it is addressed. If you are not the intended recipient, you are not authorized
to read, print, retain, copy, disseminate, distribute, or use this message or
any part thereof. If you receive this message in error, please notify the
sender immediately and delete all copies of this message.