#!/usr/bin/perl -w use strict; my $test="234"; my ($output) = $test =~ m/(.*?)<\/blah>/; print $output;