#!/usr/bin/env perl use 5.010; use strict; use warnings; my $text = <$2$3|gx; # Replace captured # sections with HTML added $text = substr($text, 1,-1); # trim off padding say $text;