#!/usr/bin/perl # http://perlmonks.org/?node_id=1210866 use strict; use warnings; $/ = '>>'; ; $/ = '"'; chomp( my $variable = ); print "variable = '$variable'\n"; __DATA__ <"Session Date:Mar 13/2017 ":>>test", 1,2,3,4 ":>>test1", 5,6,7,8 end>