[ubuntu-uk] [OT] Quick Perl question...

Matt Wheeler m at funkyhat.org
Mon Jul 12 23:46:32 BST 2010


On 12 July 2010 22:55, LeeGroups <mailgroups at varga.co.uk> wrote:
> This input <solar>8,27.31,28.68,28.81,0.00,0.00,0</solar>
> It need to be --
> 8,27.31,28.68,28.81,0.00,0.00,0
>
> Another line chops off the <solar>.
> The problem is that occasionally there is rubbish on the end of the
> line, or even another line appended to the end of the first...

You could remove both the start and end tags with something like

$solar_info =~ s!<solar>(.*)</solar>!$1!;

(note I'm also using ! instead of / so I don't have to escape the /)

-- 
Matt Wheeler
m at funkyHat.org



More information about the ubuntu-uk mailing list