Re: sequential value check

2010-02-09 Thread Curt Shaffer
> > > > Uri> post the output line from that command. do not let your emailer mung it > or word wrap it. show the part you want to extract out. there may be > easier ways to get it with a regex and not with split. I think you may be right. I would like to pull the numerics out from the id= sec

Re: sequential value check

2010-02-09 Thread Curt Shaffer
> > > Uri> no need for the = () as all arrays are created empty. I wasn't sure if strict would bark or not, so I figured better safe than sorry. > > Uri> someone told you that le is wrong for numeric comparison. and WHAT do > you think is in $_ there? you never explicitly set it. it may have so

Re: sequential value check

2010-02-09 Thread Curt Shaffer
On Feb 9, 2010, at 10:10 AM, Steve Bertrand wrote: > Uri Guttman wrote: > >> CS> foreach (@hping_array){ >> >> foreach my $ping ( @hping_array){ > > Uri showed right above how to avoid using $_. eg instead of: > I didn't read/understand that fully as to the problem at hand. I apologize. >

Re: sequential value check

2010-02-09 Thread Curt Shaffer
>> SB> # ignoring the fact that you were advised to use named variables >> # instead of $_ where possible, here is one way to do it: I do not see how I can get away from using $_ because each iteration through the loop will be a different variable and thus a different array element. This is why

Re: sequential value check

2010-02-09 Thread Curt Shaffer
#!/usr/bin/perl use warnings; use strict; my $hping; my $hping_compare; my @hping_array = (); for (1 .. 5){ $hping = `sudo hping3 www.microsoft.com -S -p 80 -c 1`; push @hping_array,(split'\ ',$hping)[15]; } $hping_compare = $hping_array[0]; foreach (@hping_array){ if ($_ le $h

Re: sequential value check

2010-02-09 Thread Curt Shaffer
> URI> still no warnings and strict. USE THEM. > > do it now. add them and declare all your variables. it will save your > ass. > I am running -w when I run the code. > > URI> what is the \ doing there. it makes the space into a space. it is not > seen by split or the regex engine. This is t

Re: sequential value check

2010-02-08 Thread Curt Shaffer
s, but I can't find any similar examples. On Feb 8, 2010, at 7:19 PM, Uri Guttman wrote: >>>>>> "CS" == Curt Shaffer writes: > > CS> OK. So I have tried some things. I guess the largest issue that I > CS> can't find an answer for elsewhere i

Re: sequential value check

2010-02-08 Thread Curt Shaffer
Thanks for the clue. I have narrowed some things down. The counter is much nicer. I just need to get a better split I think as I'm not getting the grouping I would like. On Feb 8, 2010, at 7:19 PM, Uri Guttman wrote: >>>>>> "CS" == Curt Shaffer writes: &

Re: sequential value check

2010-02-08 Thread Curt Shaffer
Thanks Jim. I see my error now. I didn't realize you could just backtick in a for like that. On Feb 8, 2010, at 7:06 PM, Jim Gibson wrote: > On 2/8/10 Mon Feb 8, 2010 3:55 PM, "Curt Shaffer" > scribbled: > >> OK. So I have tried some things. I guess the l

Re: sequential value check

2010-02-08 Thread Curt Shaffer
nt $5}'; So I know the system command by itself is working. So first question is what can help me get just the $5 into array 5 times. Then I can move on to evaluation of the array values. On Feb 8, 2010, at 6:03 PM, Uri Guttman wrote: >>>>>> "CS" == Curt Shaffer

sequential value check

2010-02-08 Thread Curt Shaffer
I'm trying to figure out a way to compare a couple values to see if they are sequential or not. I'm running a for loop and grabbing a value and setting a variable through each iteration. At the end I would like to examine the results and see if they are sequential or not. If the values are l

RE: odd variable result

2006-08-28 Thread Curt Shaffer
: Curt Shaffer; Perl List Subject: Re: odd variable result try this syntax: my $test = system ("/usr/bin/snmpget -v1 10.1.11.18 -c secret .1.3.6.1.4.1.710.7.1.5.1.23.1.13.1|awk '{print $4}'"); or my $test = qx(you command above w/no quotes needed); or open (SNMP, "

odd variable result

2006-08-28 Thread Curt Shaffer
List, I am trying to set a variable based on a system call. Here is my code: #!/usr/bin/perl use strict; my $test = system `/usr/bin/snmpget -v1 10.1.11.18 -c secret .1.3.6.1.4.1.710.7.1.5.1.23.1.13.1|awk '{print $4}'`; print "$test\n"; When I run that command from the comma

RE: FW: suggestion for sftp process

2006-03-15 Thread Curt Shaffer
-Original Message- From: Chas Owens [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 11:48 AM To: Curt Shaffer Cc: beginners@perl.org Subject: Re: FW: suggestion for sftp process On 3/14/06, Curt Shaffer <[EMAIL PROTECTED]> wrote: > I have a small update to this post

RE: FW: suggestion for sftp process

2006-03-14 Thread Curt Shaffer
-Original Message- From: KyLiE [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 10:36 AM To: Curt Shaffer Subject: Re: FW: suggestion for sftp process Curt Shaffer wrote: >I have a small update to this post. I found out that I will be able to get >all of the files in the

FW: suggestion for sftp process

2006-03-14 Thread Curt Shaffer
I have a small update to this post. I found out that I will be able to get all of the files in the remote directory. Unfortunately I do not see a way to do this with Net::SFTP. There is no mget function and * does not seem to work for the file name. Thanks Curt _ From: Curt

suggestion for sftp process

2006-03-14 Thread Curt Shaffer
I am writing a process that will need to establish a SFTP connection with a remote server, pull a file down and copy it to an archive and system folder. I also have to do the opposite where I will need to get a file from a system directory and push it via SFTP to a remote server. Now I have the pus

pushing csv vaules into hash

2006-03-09 Thread Curt Shaffer
I am really stuck here. I need to split values from a csv value and push them into an array, then perform a routine for all of them in a foreach statement. In this example I am reading an email address, a username and a password and needing to send each user listed in the csv a mail to the email ad

RE: mail list via script

2006-03-07 Thread Curt Shaffer
-Original Message- From: Ryan Frantz [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 07, 2006 11:28 AM To: Curt Shaffer; beginners@perl.org Subject: RE: mail list via script > -Original Message- > From: Curt Shaffer [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 07

RE: mail list via script

2006-03-07 Thread Curt Shaffer
-Original Message- From: Ryan Frantz [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 07, 2006 11:09 AM To: Curt Shaffer; beginners@perl.org Subject: RE: mail list via script > -Original Message- > From: Curt Shaffer [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 07

mail list via script

2006-03-07 Thread Curt Shaffer
I have a need to mail 1000 users their usernames and passwords, this will be a 1 time thing. I was thinking that I could just do some sort of foreach routine but I can't see how that will work when they will all be different. I then thought a hash with the usernames and passwords would be OK, but t

RE: regular expression in a variable

2006-02-28 Thread Curt Shaffer
esday, February 28, 2006 5:50 PM To: Curt Shaffer; beginners@perl.org Subject: RE: regular expression in a variable If you declare a variable with my(), it only exists within the current scope (NOTE: always add 'use strict' and 'use warnings' whenever you can at the top of your sc

RE: regular expression in a variable

2006-02-28 Thread Curt Shaffer
PM To: Curt Shaffer; Timothy Johnson; beginners@perl.org Subject: RE: regular expression in a variable Curt Shaffer wrote: > That appears to work! The part I am stuck on is how to I take that > value (which would now be $file in your example) and put it into a > variable that I can use th

RE: regular expression in a variable

2006-02-28 Thread Curt Shaffer
your help! -Original Message- From: Timothy Johnson [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 28, 2006 3:47 PM To: Curt Shaffer; beginners@perl.org Subject: RE: regular expression in a variable So what part are you stuck on then? It looks like the first suggestion gets you the

RE: regular expression in a variable

2006-02-28 Thread Curt Shaffer
directory. Then sftp the $filename to the appropriate place. Does that help a bit? If not I apologize. Curt -Original Message- From: Timothy Johnson [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 28, 2006 3:30 PM To: Curt Shaffer; beginners@perl.org Subject: RE: regular expression in a va

regular expression in a variable

2006-02-28 Thread Curt Shaffer
I need to set a variable to a filename where only 1 section of the file is static. For example: $filename =~ /test/; Where the following: Print "$filename\n"; Would produce: 123test456.txt The only way I see this being possible is with regular expressions but I can't fo