I created a file called data.txt which contains a bunch of junk, including some IPs. I want $line to be stored in $ip<http://www.tek-tips.com/viewthread.cfm?qid=1382614&page=1#> .
It works, except for the regular expressions which should find only IPs. If I use the regular expression with the grep command in terminal I get only the IPs. Here in Perl I don't get any output. #!/usr/bin/perl @input = `cat ~/ip.txt`; foreach $line (@input){ if($line =~ /[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}/){ $ip = $line; print $ip; } } Any ideas? It's breaking my head. Amichai