perl script

Status
Not open for further replies.

mode13h

Seniorius Lurkius
18
I am having a problem with a section of my perl script. The error I recieve is as follows: Unmatched [ before HERE mark in regex m/[ << HERE / at parse.pl line 37.

The section of code looks like this:

elsif($value =~ /\d\d?:\d\d:\d\d/){
@Z = split(':', $value);
foreach $parse(@Z){
if($parse =~ /\[\d\d/){
@split = split('[', $parse);
foreach $line(@split){
if($line =~ /\d\d/){
$line = $line + 12;
print $line;
}
else{
print $line;
}
}
}
}
}


Thanks for the help!
 

sroylance

Ars Tribunus Militum
2,156
Did your tabs get lost when you posted it, or can you actually read it like that? I had to indent it so I could read it :)
code:<HR>
Code:
<P>
elsif ($value =~ /\d\d?:\d\d:\d\d/)
	{
	@Z = split(':', $value);
	foreach $parse (@Z)
		{ 
		if ($parse =~ /\[\d\d/)
			{
			@split = split('[', $parse);
			foreach $line(@split)
				{
				if ($line =~ /\d\d/)
					{
					$line = $line + 12;
					print $line;
					}
				else { print $line; }
				}
			}
		}
	}
I think the first argument to split is really a regexp so the open bracket there should probably be escaped.
 
Status
Not open for further replies.