|Think about Loose Coupling|
Re: $/ usageby 7stud (Deacon)
|on Jan 03, 2013 at 02:08 UTC||Need Help??|
There's no need to slurp the file:
As for this:
Went with the following to do what i wanted :
basically deletes the duplicates entries one after the other with "slurping"
1) As graff already pointed out:
If you were expecting the $/="\n"; at the end of your one-liner to do something, that's your problem. That step doesn't do anything.
The values of perl's global variables are set to the defaults when a perl program starts up. So setting a global variable in the last line of a perl program does nothing. Once a program ends, all the values that were assigned to any global variables during the program are lost.
2) Your regex doesn't work:
3) Why would you ever try to cram so much code into the command line when you can write a perl program in a text file that is easier to write, edit and maintain? In any case, see if this does what you want:
Note that the order of the ip addresses in the output will be random.