#!/usr/bin/perl use warnings; use strict; my $text; while (my $line = ) { $text = $text . $line; } $text =~ /[-]+([\w.:]+)[-]+/; print "$text\n";