in reply to Read from and write to file

You might use the function lc to lowercase the whole string (i.e. $input_command) before you split it.

You can read in a file line by line with  $line=<ADDYFILE> or in one single swoop with @file=<ADDYFILE>.

To go through @file you could use foreach:
foreach my $line ( @file ) { if ($line=m/^\s*$subname\s*:\s*(\S*)/i) { do something, we found it } }
I'm assuming here that the format of @file looks something like this:
submane1: address1 subname2 : address2 ...
and addresses have no spaces in them.

Replies are listed 'Best First'.
Re^2: Read from and write to file
by Anonymous Monk on Apr 09, 2007 at 17:19 UTC
    Ummm, shouldn't that be "=~" instead of "=" in the example above? As it stands, it'll always match the if condition, as you're assigning the value of the pattern match to the variable $line. *grin*