I currently have the following:
elsif ($line =~ /^(\s*)(if|elif|else)\s*(.+)*\s*:\s*$/) { # Multiline If # Print the If/Elif condition if ($2 eq "if"){ print "$1$2 ($3){\n"; } elsif ($2 eq "elif"){ print "$1elsif ($3){\n"; } elsif ($2 eq "else"){ print "$1$2 $3{\n"; } # Add the space before the word "if"/"elif"/"else" to the stack push(@indentation_stack, $1); }
I get a reported error, but I'm not sure why. In the last elsif , if I add \ to { in the print statement, the code does not generate an error.
IE:
elsif ($2 eq "else"){ print "$1$2 $3\{\n"; }
Can someone explain to me why this is happening?
Thanks for your help!
user2268507
source share