foreach(@search)
{
# We'll put the cleaned-up URL here temporarily.
# We could do a push directly, but this will make
# debugging easier.
#
my $ready;
# You said you wanted to throw out mailtos
#
/^mailto:/ and next;
# "if ($_ !~ /^http:\/\//gi)"
#
# /g is meaningless here; the caret can only match once.
# "$_ !~ /.../" is a long way of saying "!/.../".
# Pick your quotes to avoid Leaning Toothpick Syndrome.
# And are you sure you want to start your if-else with
# a negative test?
#
if (!m[^http://]i)
{
# "if ($_ !~ /^#/g)"
#
# Same as above
#
if (!/^#/)
{
$ready = "$base$_";
}
}
else # m[^http://]
{
# "if ($_ =~ /^\#/g)"
#
# But the first character can't be "#" because
# at this point we know it's "h"!
# Shorten; /g useless
#
if (/^#/)
{
$ready = "$url$_";
}
else
{
$ready = $_;
}
}
if (not defined $ready)
{
print "$_ was lost!
\n";
next;
}
print "$_ becomes $ready
\n"; # For debugging
push @search_ready, $ready;
}