And you are sure $stock contains exactly AAPL, and not a trailing space, newline or some other character? You don't seem to chomp off the newline when reading the line for instance.
Comment on Re: How to call curl to make a Get request with parameters from perl ?