in reply to Unique Array Entries

use strict; my $lastline; while (<DATA>) { chomp; unless (/^\Q$lastline\E/) { print $lastline,"\n"; }; $lastline = $_; }; # Assuming that the last line read will always # be relevant print $lastline; __DATA__ CHILD: Topology/IPClassA CHILD: Topology/IPClassA/Device CHILD: Topology/IPClassA/Device/log_ratio CHILD: Topology/IPClassA/Device/poll_interval CHILD: Topology/IPClassA/Device = 2 CHILD: Topology/IPClassA/Device = 2/poll_interval CHILD: Topology/IPClassA/Device = 2/is_managed CHILD: Topology/IPClassA/Device = 2/Port CHILD: Topology/IPClassA/Device = 2/Port/ifPhysAddress CHILD: Topology/IPClassA/Device = 2/Port/poll_interval CHILD: Topology/IPClassC CHILD: Topology/IPClassC/Device CHILD: Topology/IPClassC/Device/poll_interval CHILD: Location
gives
D:\Downloads>perl -w tmp.pl Use of uninitialized value in quotemeta at tmp.pl line 9, <DATA> line +1. CHILD: Topology/IPClassA/Device/log_ratio CHILD: Topology/IPClassA/Device/poll_interval CHILD: Topology/IPClassA/Device = 2/poll_interval CHILD: Topology/IPClassA/Device = 2/is_managed CHILD: Topology/IPClassA/Device = 2/Port/ifPhysAddress CHILD: Topology/IPClassA/Device = 2/Port/poll_interval CHILD: Topology/IPClassC/Device/poll_interval CHILD: Location

This is one line less than what you want, as you seem to want to handle

CHILD: Topology/IPClassA/Device = 2/Port
in a special way.

perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web

Replies are listed 'Best First'.
Re: Re: Unique Array Entries
by The_Rev (Acolyte) on Mar 02, 2002 at 16:32 UTC
    Corion, You are correct, regarding Child: Topology/IPClassA/Device = 2/Port That was a typo. Thanks
      That should not have made the list