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

Hi, Please i need help in writing simple a Perl script executable on linux terminal to ping like multiple IPv6 addresses saved already in a file.txt and probably saving pingables and not pingables addresses in different files. Thanks

Replies are listed 'Best First'.
Re: PERL SCRIPT FOR IPv6 LOOK-UP
by sweetblood (Prior) on Jun 08, 2010 at 17:13 UTC
    In what way do you need help? Have you started this project? Do you have code that is giving you problems?

    Sweetblood

      thanks for quick repsonse;i actually have 2codes that i got from the internet and trying but isnt working,here are they: here's the simple one that isnt working too;
      #!/bin/sh # # pinghosts - ping hosts in /home/olle/file2.txt, output is coloured ( +red=bad). Ver 1.00. # # for host in `awk '/^[0-9]/ { print $1 }' /home/ole/file2.txt` do echo "Checking $file2: \c" ping6 $host 1 2>&1 | \ sed 's/.*no answer.*/[31;1m& [0m/;s/.*is alive.*/[32;2m& [0m/' done
        This is not a perl script, it's a shell script.

        Sweetblood

        A reply falls below the community's threshold of quality. You may see it by logging in.
        heres the second code
        #!/usr/bin/perl use Net::Ping6; open(INFILE, "<", "/home/olle/file2.txt") or die("cannot open infile: + $!"); my @ip_array = <INFILE>; close(INFILE); open(OUTFILE, ">", "ping_output") or die("unable to write output: $!") +; chomp(@ip_array); $p = Net::Ping->new(); foreach(@ip_array) { if($_ =~ /\d+.\d+.\d+.\d+/) { if($p->ping6($&)) { print OUTFILE ("$`is responding to ping.\n"); } else { print OUTFILE ("$`is NOT responding to ping.\n"); } } } close(OUTFILE);