There's more than one way to do things | |
PerlMonks |
Re: Re: Re: same 500 server error problem shorter questionby Cirollo (Friar) |
on Jun 06, 2001 at 18:45 UTC ( [id://86242]=note: print w/replies, xml ) | Need Help?? |
I'm not sure exactly what you want to do here, but as it stands, this part of your code doesn't do anything.
return ends the subroutine and passes back it's arguments. So, for this to do something, you will want to get the result of the subroutine by saying $result = getgold; or some such. So now, $result will contain a string from 2 characters after the ':' in $GoldLine to the end. Its good programming practice to use parentheses on funtions to make it clear what you're doing. So, you should say substr($start, length $line) instead of substr $start, length $line to be more explicit. Update: Oops, that probably isn't doing what you want. The first argument to substr is the string that you're operating on. So, assuming you want to find a substring of $GoldLine, you would really want to say substr($GoldLine, $start, length $line). Also, if you omit that 3rd parameter, substr returns everything until the end of the string. So, you can just say substr($GoldLine, $start). Also, if you want to see errors in your web browser instead of the dreaded "500 Server Error", add the line use CGI::Carp qw/fatalsToBrowser/; at the top of your script. Note that this only prints runtime errors; compiliation errors will give a rather unhelpful 'compilation failed' message.
In Section
Seekers of Perl Wisdom
|
|