in reply to Extract content between two special character which is in single line or another line

Here's how I'd do it: $parameter is defined if we are inside a block we want to process, undefined otherwise. $is_first_block just prevents a newline before the first block:

#!/usr/bin/perl use warnings; use strict; my $is_first_block = 1; my $parameter; while (<>) { if (/^ \s* " ( [^"]+ ) " \)/x) { $parameter = $1; print "\n" unless $is_first_block; undef $is_first_block; } elsif (/;;/) { undef $parameter; } if (defined $parameter && /(\w+=.*)/) { my $var = $1; print "$parameter\t$var\n"; } }

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
  • Comment on Re: Extract content between two special character which is in single line or another line
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Extract content between two special character which is in single line or another line
by ararghat (Novice) on Sep 27, 2016 at 09:49 UTC

    thank you chobara