[ubuntu-uk] [OT] Quick Perl question...
Thomas Ibbotson
thomas.ibbotson at gmail.com
Mon Jul 12 21:32:08 BST 2010
On 12 July 2010 21:12, LeeGroups <mailgroups at varga.co.uk> wrote:
> $solar_info =~ s/<\/solar>.*/,/;
>
> From my tinkerings, this should find the string </solar> in the string
> $solar_info, and then remove it and any number of following characters
> (the .*) and then replace them with a ",".
> Except that it doesn't. It hacks out the </solar> and replaces it with a
> , but leaves the rest of the string intact... Much to my annoyance... :|
>
> Any clues?
What's the input string? The following code simply prints "," for me
not ",abcdef" as you suggest it would:
$test = "</solar>abcdef";
$test =~ s/<\/solar>.*/,/;
print $test;
Tom
p.s. I don't know perl but I thought I'd have a play anyway
More information about the ubuntu-uk
mailing list