Hi,
I have the following code to parse a config file:
my @section_headers = ("general", "database", "preprocessing",
"postprocessing", "queries");
....
while(<>)
{
/^[\t ]*$/ && { print "blank\n" };
/^[\t ]*#/ && { print "comment\n" };
/\[.*\]/ &&
{
$config_section = (split (/[\[\]]/,$_))[1],
print $config_section ." \n",
# foreach $i (@section_headers)
# {
# $config_current_section = (lc($config_section) eq $i) ?
$i:$config_current_section
# },
# die "config error - no valid section header\n" if
($config_current_section ne $config_section && $config_current_section ne
"queries"),
# for(my $x;$x<10;++$x) print "gg",
print "in section $config_current_section -> $config_section\n"
};
}
Now why am I getting syntax errors as soon as I uncomment either
the foreach stuff, the die line, or the for loop.
I came accross the while loop and the "/(matches)/ && (commands)"
when looking for a "select ... case" equivalent in perl, but I
don't want to push every additional processing of $_ to subroutines
and call them from the while loop...
Any help on how I can fix this ?
TIA,
Filip
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]