#!/usr/local/bin/perl my $data = 'Sending 104 bytes *** POST /path HTTP/1.0^M Content-type: text/xml^M Content-length: 37^M ^M SENT 104 HEADER HTTP/1.1 401 Unauthorised^M Connection: Close^M Content-Length: 0^M ^M '; my @splitdata = split(/\n{2,}/, $data); my $lastValue = pop @splitdata print"Last value => $lastValue\n"; Expected output: Last value=> ' '