Hi Perl GURUs, I have a json file that needs parsing. Here is a typical string I’m searching for. I want to delete everything but the last 2 character “],”.
], [ "ansible", "2.1.0.0-1ppa~trusty", false ], Here is what I tried: I slurp the whole file into a variable. my $SAVE = $/; my $WHOLE_JSON_FILE = `cat ${JSON_FILE}`; $/ = $SAVE; while($WHOLE_JSON_FILE !~ /.*?(\s+\]\,\s+\[\s+\"ansible\".*?)\]\,?/gs) { print "\$1 is $1"; } The print statement is printing out the “matching string” but how do I remove that section of string from the slurp $WHOLE_JSON_FILE variable which contains the entire file content? ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The contents of this electronic message, including any attachments, are intended only for the use of the individual or entity to which they are addressed and may contain confidential information. If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this message or any attachment is strictly prohibited. If you have received this transmission in error, please send an e-mail to postmas...@whitehatsec.com and delete this message, along with any attachments, from your computer.