in reply to Getting content of case statement appended by inner case statement

Tips for asking a question that will receive useful answers here:

  1. Provide runnable sample code demonstrating your problem, including the appropriate input data as well as the desired output.
  2. Tell us what the problem is.
  3. Ask a Perl-related question.

"This fragment of bash script should provide this output" is not really something we can help with, unless someone spots a blatant syntax error, because we don't know what it's doing instead of producing the desired output and we can't run it ourselves to find out.

  • Comment on Re: Getting content of case statement appended by inner case statement

Replies are listed 'Best First'.
Re^2: Getting content of case statement appended by inner case statement
by ararghat (Novice) on Oct 12, 2016 at 11:48 UTC

    my code is

    open (data, "<input.txt"); while (<data>) { s/^\s+//g; #LTRIM if (/"(.*)"\)(.*)$/) { #pattern match $parameter = $1; $var = $2 . "\n"; } else { $var = $_; } if (/case/../esac/){ if (/"(.*)"\)(.*)$/) { $parameter ="$parameter:$1"; $var = $2 . "\n"; } } if (/;;/) { print "\n"; next; } if($var=~/^\s*$/) {next;} #if $var is empty or 1 or more than 1 + whitespaces. elsif ($var!~/=/) {next;} #ignore if $var does not consist "=" +sign else{ print "$parameter: $var"; } } close data;