Re: Help optimizing script

2004-12-07 Thread Jonathan Paton
On Tue, 7 Dec 2004 13:54:41 -0500, Ed Christian <[EMAIL PROTECTED]> wrote: > [SNIP] > I'm certainly far from a Perl expert, but one suggestion I do have is to > be careful to test that your regular expression does have a match before > using $1. I believe $1 contains the first match from the last >

RE: Help optimizing script

2004-12-07 Thread Ed Christian
JR wrote: > Greetings everyone, > > I'm very new to perl, so please don't laugh at my script ;-) > I wrote this script to login to my work box from home and change a > hosts > file to reflect my home ip address. I know there is a way to do this a > lot quicker and prettier. This is really just a

Re: Help optimizing script

2004-12-07 Thread JupiterHost.Net
#!/usr/bin/perl # Script to login to work machine and rewrite /$home/etc/hosts entry #there use strict; use warnings; Excellent! use Net::SSH qw(sshopen2); my $ppp0 = `/sbin/ifconfig ppp0`; $ppp0 =~ m/(\d+\.\d+\.\d+\.\d+)/; my $ip = $1; my $user = "jrak"; my $