I have one program that reads the contents of a file generated by a colleague, splits that data, and enters it into a BerkeleyDB. I now have another script which I'd like to periodically go through the keys of that hash, split the associated value, and perform a get on one of those values. if i do
foreach my $x (keys %hash)
{
my $data = $hash{$x};
print "$x\n";
}
the keys and associated values are correct. similarly if I split $data and just print the one element that I want. Things get weird when I add WWW::Mechanize into the mix. say within the above loop I have:
my @parts = split(/\t/, $data);
my $url = $parts[0];
$mech->get( "$url" );
then the get operation is never successful. when I take a closer look at $x and $url, things are now funny. the contents of $x should be something like OtnFfkSpw6A. they are now --FfkSpw6A, the 1st 2 characters have been replaced with a -'s. Something similar happens with the $url, $x is actually a part of the url, and the same 2 characters are replaced. what could cause this? what am i doing wrong!
thanks, monks.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.