#!/usr/bin/perl #get start and end comment my $start = $ARGV[0]; my $end = $ARGV[1] || "\n"; open(FILE, "test.txt") || die; { local $/ = undef; #set to 'slurp' mode $_ = ; #read entire file into $_ } close FILE; # #print all comments that are matched in file # while( /\Q$start\E(.*?)\Q$end\E/sg ) { print $&, "\n"; }