I wrote a simple program that you might find useful.
my $file = 'test.txt';
my $content = get('http://www. google.com');
open FH, " >", "$file" or die "Error: $!\n";
print FH $content until -s $file >= 25;
# I routinely include code to check for a successful closing
# of the filehandle since a hardware error could occur.
close FH or die "Error: $!\n";