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

@system_call=('host' , "192.168.$help.1");$help = '
i need the $help variable to read a list of numbers from a file one at a time and print the results of the ip resolutions'; im just learning perl so if i dont articulate well enough its becouse im in /tmp/stupid for the moment. thanks.

edited: Mon Jul 29 13:44:29 2002 by jeffa - code tags and title change (was: i cant explain this...just look.)

Replies are listed 'Best First'.
Re: i cant explain this...just look.
by DamnDirtyApe (Curate) on Jul 29, 2002 at 09:07 UTC

    I think this is what you're shooting for:

    #! /usr/bin/perl use strict ; use warnings ; $|++ ; # @system_call=('host' , "192.168.$help.1");$help = 'i need the $help # variable to read a list of numbers from a file one at a time and pri +nt # the results of the ip resolutions'; im just learning perl so if i do +nt # articulate well enough its becouse im in /tmp/stupid for the moment. # thanks. #--------------------------------------------------------------------- +-- open IN, 'my_file.txt' ; while ( <IN> ) { chomp ; print `host 192.168.$_.1` if /\d+/ ; } close IN ; exit ; __END__

    _______________
    D a m n D i r t y A p e
    Home Node | Email
      thank you very much for helping me. and this wasnt homework. $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);
Re: i cant explain this...just look.
by Marza (Vicar) on Jul 29, 2002 at 07:32 UTC

    Hmmmm this sounds like homework. We don't give out answers and tend to help those who help themselves

    What you need to do is to first open the file. Look to open on what to do with that. Also, make use of die for error control and termination.

    Then you need a loop. I would use foreach

    Don't forget to make use of "use strict" and "use warnings" as they will help you debug stuff

    These hints should get you going. Good luck.

Re: i cant explain this...just look.
by cybear (Monk) on Jul 29, 2002 at 10:21 UTC
    No self-depricating humor please. Even the "Saints" have bad days.