in reply to Re: Get text between start and end tag
in thread Get text between start and end tag
Thank you very much!! This solved my problem. I just slurp the text file in a string variable and then apply your regex which I can now fully understand.
#!/usr/bin/env perl use strict; use warnings; use Data::Dumper; my $file = 'textfile.txt'; open my $fh, '<', $file or die; $/ = undef; my $text = <$fh>; close $fh; my %res = $text =~ /BEGIN_TAG_(\d+)(.*?)END_TAG/sg; print Dumper (\%res);
|
|---|