in reply to Re^2: Edit in place (part2)
in thread Edit in place (part2)

Can you post the code that is in somesub()?
-imran

Replies are listed 'Best First'.
Re^4: Edit in place (part2)
by jzb (Hermit) on May 01, 2006 at 21:13 UTC

    It returns an IP address in the form of 1.2.3.4. I cannot post my code on a public forum (sorry).
    -j

      Seems to me that CountOrlok is on to something there. If you replace the sub with a string constant does the problem go away?

      Perhaps you need to examine the contents of the sub. Presuming that that is where the problem is, try removing stuff from it until the problem goes away. If you can't find the issue that way, strip the code down to the point where you can show it to us and post it as a new SoPW.


      DWIM is Perl's answer to Gödel
        Yes, if the $myvar is given a string the problem goes away. I'm confused as it's only asking for an ip address to use to sub in a file with a placeholder.

      Then simplify the function until either 1) the error goes away (in which case you found the problem), or 2) the code is safe to post. How come you're not using Socket's inet_ntoa anyway? Example

        Ok here is a very simple script demonstrating the problem. If you comment out the input for hereistheip() and substitiute a static variable it works. This has to be due to the <>. Remember, this is to run under perl 5.005_03 only!
        #!/usr/bin/perl -w use strict; use diagnostics; mysub(); sub mysub{ my $vari = hereistheip(); print "This is the IP you entered --> $vari\n"; local $^I = ".bak"; @ARGV = "stuff"; while (<>) { s/FOO/$vari/i; print; } } sub hereistheip{ print "Enter a valid server IP \n --> "; my $myip = <>; chomp $myip; return $myip; }