aboboras has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Perl bug or what?
by davido (Cardinal) on Mar 05, 2014 at 02:20 UTC

    Show a simple test case that demonstrates the behavior. Until then I'll be sure not to panic.


    Dave

Re: Perl bug or what?
by kennethk (Abbot) on Mar 05, 2014 at 02:12 UTC
    There is no known issue with the transformation you have described above.

    Please read Basic debugging checklist. In order to be helpful here, the monks will need more context. Please take the two scripts which are displaying different behavior, and make them as simple as possible while still displaying the issue you mention. For example, I get successful conversion with the one-liner

    perl -E '$string = "5abc"; $x = 0 + $string; print "$x\n"'
    which ouptuts
    5
    Also, please wrap you code in <code> tags to avoid formatting headaches; see How do I post a question effectively?.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Re: Perl bug or what?
by syphilis (Archbishop) on Mar 05, 2014 at 02:11 UTC
    It works perfectly on one script but not on another one

    How are you determining whether it's a string or a number ?
    (A simple demo script would be the best way to show us.)

    Cheers,
    Rob
Re: Perl bug or what?
by AnomalousMonk (Archbishop) on Mar 05, 2014 at 17:34 UTC
    It works perfectly on one script but not on another one.

    Others have already made the request for the vital small, runnable, standalone program demonstrating the problem. Also, please be aware that "it doesn't work" is not an appropriate problem description. (???? indeed!) Please see How do I post a question effectively? and How (Not) To Ask A Question.