AW:AW: Problem with Net::Ping

2002-07-30 Thread Angerstein
I did 2 things: Startet my program and make a System Core Dump and try to analyse it. (Seem that PING.pm have some problem to be load by the dynaloader especialy an hash %s is named a lot of times.) I set up a network analyser (ethereal) then i startet my programm. If I use the tcp protocoll no p

Re: One stupid question

2002-07-30 Thread Felix Geerinckx
on Tue, 30 Jul 2002 18:27:18 GMT, [EMAIL PROTECTED] (Brian Bratcher) wrote: > what is the difference between: > > my $number = 200; > and > $number = 200; > ? You should read e.g. M-J Dominus' article 'Coping with Scoping' at -- felix -- T

RE: One stupid question

2002-07-30 Thread Christian Andreassen
Try: perldoc perlfaq7 -ca -Original Message- From: Brian Bratcher [mailto:[EMAIL PROTECTED]] Sent: 30. juli 2002 20:27 To: [EMAIL PROTECTED] Subject: One stupid question Ok, I have developed a few cgi scripts. Some are located at: http://www.addapage.net/cgi-scripts/index.html I have d

One stupid question

2002-07-30 Thread Brian Bratcher
Ok, I have developed a few cgi scripts. Some are located at: http://www.addapage.net/cgi-scripts/index.html I have developed on an "as we learn" type of situation. Now I must ask; what is the difference between: my $number = 200; and $number = 200; ? Im sorry to be stupid in this manner, but I

Re: file with unique records

2002-07-30 Thread John W. Krahn
Pedro A Reche wrote: > > Hi all, Hello, > I have a file that it looks as it follows: > > >name1 > ADASDADFSDF > ADASDADFSDF > SDFDSFDSDFDF > >name2 > ASDFDFDFFDF > ADFEERERREWR > ADFADFQERQEWR > >name1 > ADASDADFSDF > SDFDSFADFDF > SDFDSFDSDFDF > >name3 > SDAFSDFDFF > WERWERER > WERWERER > >

RE: File munging: from $old to $new, using filehandles andarrays ....

2002-07-30 Thread McCormick, Rob E
John, thanks for the succinct suggestion on the set in place edit extension.I'll humbly accept additional "yo here's how to simplify this deal" examples. ;^) I could still be doing a number of things wrong, I can launch the script , but it 'hangs', & my prompt doesn't return. I'm not getting

file with unique records

2002-07-30 Thread Pedro A Reche
Hi all, I have a file that it looks as it follows: >name1 ADASDADFSDF ADASDADFSDF SDFDSFDSDFDF >name2 ASDFDFDFFDF ADFEERERREWR ADFADFQERQEWR >name1 ADASDADFSDF SDFDSFADFDF SDFDSFDSDFDF >name3 SDAFSDFDFF WERWERER WERWERER and I want to have something like this: >name1 ADASDADFSDFADASDADFSDFSDFDSF

RE: Down and dirty duplicate deleter

2002-07-30 Thread Nikola Janceski
as per Japhy, corrected below { my %seen; @uniq = grep { !$seen{$_}++ } @arrayWithDups; } ## then ignore this @uniq = map { my $temp = $_ ^ $temp; } @uniq; undef @uniq; # now @uniq contains no duplicates. (nor anything else). :P > -Original Message- > From: Nikola Janceski [mailto:[EMA

Re: Down and dirty duplicate deleter

2002-07-30 Thread Jeff 'japhy' Pinyan
On Jul 30, Jeff 'japhy' Pinyan said: >On Jul 30, Kirby_Sarah said: > >>I have instances where I want to delete duplicate elements out of an array. >>Is there an easy way to do this? > >Yes, and the FAQ tells you: > > >http://www.perldoc.com/perl5.6.1/pod/perlfaq4.html#How-can-I-remove-duplicate

Re: Down and dirty duplicate deleter

2002-07-30 Thread Robin Norwood
Kirby_Sarah <[EMAIL PROTECTED]> writes: > Hi, > > I have instances where I want to delete duplicate elements out of an array. > Is there an easy way to do this? Sure, The Perl Cookbook provides several ways - here's one: (Recipe 4.6, page 102) my @list = qw/one two three one two five/; my @

RE: Down and dirty duplicate deleter

2002-07-30 Thread nkuipers
Load the elements of an array into a hash. Then put the unique keys back into the array; add other goodies like sorting if you need, but one barebones way of doing it would be: for (@array) { chomp $_; $hash{$_}++ } @array = (); @array = keys %hash; -- To unsubscribe, e-mail: [EMAIL PROTECT

RE: Down and dirty duplicate deleter

2002-07-30 Thread Jeff 'japhy' Pinyan
On Jul 30, Nikola Janceski said: >{ >my %seen; >@uniq = grep { !$seen{$_}++ }, @arrayWithDups; >} That comma will get you. Either grep BLOCK LIST or grep EXPR, LIST but never grep BLOCK, LIST -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia

RE: Down and dirty duplicate deleter

2002-07-30 Thread Timothy Johnson
One of the classic ways is to assign each element as a key of a hash. foreach(@array){ $hash{$_} = 1; } @array = keys %hash; -Original Message- From: Kirby_Sarah [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 12:04 PM To: [EMAIL PROTECTED] Subject: Down and dirty duplicate d

Re: Down and dirty duplicate deleter

2002-07-30 Thread Jeff 'japhy' Pinyan
On Jul 30, Kirby_Sarah said: >I have instances where I want to delete duplicate elements out of an array. >Is there an easy way to do this? Yes, and the FAQ tells you: perldoc -q duplicate or perldoc -q unique depending on which version of Perl you've got. (Newer versions have it under

RE: Down and dirty duplicate deleter

2002-07-30 Thread Shishir K. Singh
>Hi, >I have instances where I want to delete duplicate elements out of an array. >Is there an easy way to do this? Well, if the order of the elements in the array does not matter, then you may try putting he array elements in a hash ++$uniq{$_} for (@array); then convert it back to array;

RE: Down and dirty duplicate deleter

2002-07-30 Thread Nikola Janceski
{ my %seen; @uniq = grep { !$seen{$_}++ }, @arrayWithDups; } > -Original Message- > From: Kirby_Sarah [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 30, 2002 3:04 PM > To: [EMAIL PROTECTED] > Subject: Down and dirty duplicate deleter > > > Hi, > > I have instances where I want to de

Down and dirty duplicate deleter

2002-07-30 Thread Kirby_Sarah
Hi, I have instances where I want to delete duplicate elements out of an array. Is there an easy way to do this? -Sarah -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: your frank opinion requested

2002-07-30 Thread Janek Schleicher
Nkuipers wrote at Tue, 30 Jul 2002 19:22:53 +0200: > I am a relative newcomer to the language (couple of months), and I totally > love it. One way or the other, I use it almost every day in my work, and even > beyond practical applications I want to improve my Perl as much as I can. I > own

Re: your frank opinion requested

2002-07-30 Thread John W. Krahn
Nkuipers wrote: > > Hello all, Hello, > I am a relative newcomer to the language (couple of months), and I totally > love it. One way or the other, I use it almost every day in my work, and even > beyond practical applications I want to improve my Perl as much as I can. I > own the Camel 3ed,

RE: How to replace a literal with a variable

2002-07-30 Thread Timothy Johnson
Do you mean something like this? open(LOG,"log.txt"); my %errs = (); while(){ chomp $_; my($details,$err) = split(/\|/,$_); $err =~ s/^\s+//; $errs{$err}++ if $err; } print "Total for each error:\n"; print "-\n\n"; foreach(sort k

Re: cisco regexp

2002-07-30 Thread John W. Krahn
Hernan Marcelo Salvarezza wrote: > > Hello all, i am parsing a cisco log and i can'nt find the exact > regexp,following goes the log and the script.. > > Jul 25 10:39:12 10.0.0.1 852: 1d23h: %VOIPAAA-5-VOIP_CALL_HISTORY: > CallLegType 2, ConnectionId 0 0 0 0, SetupTime *10:46:49.143 GMT Thu Jul

Re: your frank opinion requested

2002-07-30 Thread drieux
On Tuesday, July 30, 2002, at 10:22 , nkuipers wrote: [..] > for someone who intends to pursue Perl while he's still breathing, would > you > recommend purchasing the Cookbook as an investment in skills and > time-saving? [..] it would have been nice to have had it around when i started playin

Re: your frank opinion requested

2002-07-30 Thread Felix Geerinckx
on Tue, 30 Jul 2002 17:22:53 GMT, Nkuipers wrote: > for someone who intends to pursue Perl while he's still breathing, > would you recommend purchasing the Cookbook as an investment in > skills and time-saving? Yes, without any doubt whatsoever. But why don't you convince yourself, and look at

Fw: Help, I suppose.

2002-07-30 Thread Tómas Guðmundsson
- Original Message - From: "Tómas Guðmundsson" <[EMAIL PROTECTED]> To: "Janek Schleicher" <[EMAIL PROTECTED]> Sent: Tuesday, July 30, 2002 8:41 AM Subject: Re: Help, I suppose. > okey, I made it a hash now. And everything works and that's nothing but > cool! > > But what do I do to make

RE: HTML, Urgent

2002-07-30 Thread Perl
Hi, If I understand correctly, you want to have an image of a form underneath text written on top, to look like the text is in the form. The problem is the image is small and a bad resolution for printing, but high resolution makes it just look huge and prints on more than one page. I am not an

your frank opinion requested

2002-07-30 Thread nkuipers
Hello all, I am a relative newcomer to the language (couple of months), and I totally love it. One way or the other, I use it almost every day in my work, and even beyond practical applications I want to improve my Perl as much as I can. I own the Camel 3ed, and between that and a resource-g

Re: How to replace a literal with a variable

2002-07-30 Thread Larry Steinberg
Here is what I need. I hope this explains it better. I have a script which creates a report for No Listings Found errors. I'd like to adapt it to create a report for any "ERR " code condition in the log. The errors and values are below. TIA! >>>Error | Value<<< city not in state | TSE ZIP not

RE: empty a dir

2002-07-30 Thread Nikola Janceski
nope that won't work. s/he wants recursive removal. not just files. check search.cpan.org for File::Path docs or perldoc File::Path use rmtree. > -Original Message- > From: NYIMI Jose (BMB) [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 30, 2002 12:54 PM > To: loan tran; [EMAIL PROTEC

RE: empty a dir

2002-07-30 Thread NYIMI Jose (BMB)
Try this: @files=glob("/sybase/dba/scripts/dbuser_report/*"); unlink(@files); HTH, José. -Original Message- From: loan tran [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 6:44 PM To: [EMAIL PROTECTED] Subject: empty a dir Is there a better way to do this in perl: $reportdi

RE: empty a dir

2002-07-30 Thread Nikola Janceski
File::Path has a function called rmtree. > -Original Message- > From: loan tran [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 30, 2002 12:44 PM > To: [EMAIL PROTECTED] > Subject: empty a dir > > > Is there a better way to do this in perl: > > $reportdir = '/sybase/dba/scripts/dbuse

empty a dir

2002-07-30 Thread loan tran
Is there a better way to do this in perl: $reportdir = '/sybase/dba/scripts/dbuser_report'; `rm -r $reportdir/*`; __ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: Problem with Net::Ping

2002-07-30 Thread drieux
On Tuesday, July 30, 2002, at 01:47 , Sudarshan Raghavan wrote: [..] > I think this has the same issue, the machine being pinged must recognize > tcp echo requests. On my machine RH linux 7.3 I have to configure xinetd > to accept and reply to udp and tcp echo requests. I guess in both these > ca

Re: How to replace a literal with a variable

2002-07-30 Thread Jeff 'japhy' Pinyan
On Jul 30, Larry Steinberg said: >How can I replace the literal "nlf" with a variable in the code below? This was asked and answered in CLPM, but I'll answer anyway. >sub parseLogLine { >$line = $_; > >%searchInfo = (); >@searchInfo = split / +/, $line; > ># found any listings?

RE: How to replace a literal with a variable

2002-07-30 Thread Jeff 'japhy' Pinyan
On Jul 30, nkuipers said: >I'm probably not understanding what exactly you needbut...as I see it, >$err holds whatever error message that you captured with a regex. So if you >want to make a variable with the same name as the literal, dereference a >variable with the name held in $err and th

RE: How to replace a literal with a variable

2002-07-30 Thread Timothy Johnson
If you just want to repolace "nlf" with a variable, you can just replace it with a variable? if ($err eq $variable){ Or else you need to be more specific about what you need. -Original Message- From: Larry Steinberg [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 8:06 AM To: [E

RE: HTML, Urgent

2002-07-30 Thread Timothy Johnson
This almost sounds like something that the cgi list might be able to answer better. -Original Message- From: Omar Shariff [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 7:37 AM To: [EMAIL PROTECTED] Subject: HTML, Urgent Hi, i correct the problem with NT, and was the server ht

RE: How to replace a literal with a variable

2002-07-30 Thread nkuipers
I'm probably not understanding what exactly you needbut...as I see it, $err holds whatever error message that you captured with a regex. So if you want to make a variable with the same name as the literal, dereference a variable with the name held in $err and the new var will autovivify:

problem with count record and while loop

2002-07-30 Thread loan tran
Hi everyone, Could you point out what is wrong the count and the while loop below? Here is part of the script: $sql_alias = qq( select aliasName = l.name from master..syslogins l, $eachdb..sysusers u, $eachdb..sysalternates a where a.suid = l.suid and a.altsuid = u.

How to replace a literal with a variable

2002-07-30 Thread Larry Steinberg
Hi, How can I replace the literal "nlf" with a variable in the code below? Thanks in advance. sub parseLogLine { $line = $_; %searchInfo = (); @searchInfo = split / +/, $line; # found any listings? $numListings = $searchInfo[8]; $numCategories = $searchInfo[10]; #

HTML, Urgent

2002-07-30 Thread Omar Shariff
Hi, i correct the problem with NT, and was the server html... Now i have another problem i'm trying to put a image in a page (its a form image) and write over with a database records... well my problem is: the image when i resize to enter in a Legal size, see bad, i see in other page that the imag

Re: Problem with Net::Ping

2002-07-30 Thread drieux
On Tuesday, July 30, 2002, at 09:18 , Jean-Luc BEAUDET wrote: [..] > Yu have to be aware that, generally, if yu go out the local network > FireWall > block ICMP packets... > > The ping statement is not a good evidence test... excuse me while I giggle... a bit here. I have no idea how many time

RE: cisco regexp

2002-07-30 Thread nkuipers
>Jul 25 10:39:12 10.0.0.1 852: 1d23h: %VOIPAAA-5-VOIP_CALL_HISTORY: >CallLegType 2, ConnectionId 0 0 0 0, SetupTime *10:46:49.143 GMT Thu Jul >25 2002, PeerAddress 0051122323223, PeerSubAddress , DisconnectCause 0 >, DisconnectText , ConnectTime *10:47:09.753 GMT Thu Jul 25 2002, >DisconnectTime *

Re: Problem with Net::Ping

2002-07-30 Thread Sudarshan Raghavan
On Tue, 30 Jul 2002, drieux wrote: > > On Tuesday, July 30, 2002, at 01:31 , Sudarshan Raghavan wrote: > [..] > > The system ping command sends ICMP echo packets and by default Net::Ping > > sends udp packets. This will work only if the machine you are pinging > > supports udp echo requests. For

RE: cisco regexp

2002-07-30 Thread Hanson, Rob
I don't have an answer for your question, because frankly that regex makes my head hurt :-0 What I suggest is making something a little more reusable by actually parsing the info istead of just grepping for what you need this particular time. I would do something like this... my $log_entry = q[

RE: WINNT

2002-07-30 Thread Hanson, Rob
I noticed this in your output: "Content-type: text/html; charset= ISO-8859-1" Are you running this in the browser though IIS or at the command line? If you are running it though IIS you won't see any error messages if the program dies. Try running the script at the command line (if you haven't

Re: Problem with Net::Ping

2002-07-30 Thread drieux
On Tuesday, July 30, 2002, at 01:31 , Sudarshan Raghavan wrote: [..] > The system ping command sends ICMP echo packets and by default Net::Ping > sends udp packets. This will work only if the machine you are pinging > supports udp echo requests. For compatibility with system ping command > change

cisco regexp

2002-07-30 Thread Hernan Marcelo Salvarezza
Hello all, i am parsing a cisco log and i can'nt find the exact regexp,following goes the log and the script.. Jul 25 10:39:12 10.0.0.1 852: 1d23h: %VOIPAAA-5-VOIP_CALL_HISTORY: CallLegType 2, ConnectionId 0 0 0 0, SetupTime *10:46:49.143 GMT Thu Jul 25 2002, PeerAddress 0051122323223, PeerSubAdd

RE: WINNT

2002-07-30 Thread Kipp, James
I think you need to take a look at perdoc dbi. try breaking the script down into sections. first try just connecting to your datasource and see if that produces any errors, then proceed with the next section. also take a look at the docs for the execute(). you don't need to assign the execute() to

Re: Help, I suppose.

2002-07-30 Thread Jeff 'japhy' Pinyan
On Jul 30, Tómas Guðmundsson said: >my $phone_book = qw{ > Fred 0123 > John 4567 > Bill 8901 >}; If you had warnings on, you'd see that this wasn't doing very much. >my $selection = 1; >do { > print "\n Please select one choice"; > print "\n 1. Enter name."; > print "\n 2. Quit.\n"; > >ch

RE: Sort table with dynamic order of fields

2002-07-30 Thread Timothy Johnson
Here's a thought: You can convert the Excel spreadsheet to a .csv file and then use DBD::CSV to sort the fields. You should be able to do this using Win32::OLE as long as you run it on a system with Excel installed. The macro code fro saving the file to a .csv is: ActiveWorkbook.SaveAs Fi

Re: Classic text problem: matching consecutive newlines

2002-07-30 Thread John W. Krahn
Steve Grazzini wrote: > > Kevin Zembower <[EMAIL PROTECTED]> wrote: > > I'm facing what I believe to one of the classic text manipulation > > problems, transforming a document which was typed with a hard return > > at the end of every physical line, and two consecutive newlines to > > mark the en

Re: How initialize hash inside a while loop ?

2002-07-30 Thread Sudarshan Raghavan
On Tue, 30 Jul 2002, Jean Berthold wrote: > my @array ; > my $counter = 0 ; > # how to declare the prototype for the record used below ??? > my $record = { FS, SNAP_PATH, TAPE_POS } ; # don't function ... You don't have to declare the keys of a hash beforehand. When you say my $record = {

Re: How initialize hash inside a while loop ?

2002-07-30 Thread Felix Geerinckx
on Tue, 30 Jul 2002 10:51:56 GMT, [EMAIL PROTECTED] (Jean Berthold) wrote: > In my case : > > my @array ; > my $counter = 0 ; > # how to declare the prototype for the record used below ??? > my $record = { FS, SNAP_PATH, TAPE_POS } ; # don't function ... There is no need to declare a prototype

Re: Any better way to make 1000000 becomes 1,000,000 ?

2002-07-30 Thread chris
This works for me http://search.cpan.org/doc/WRW/Number-Format-1.44/Format.pm use strict; use warnings; use Number::Format qw(:subs :vars); $THOUSANDS_SEP = '.'; $DECIMAL_POINT = ','; my @number = (123456789,123); foreach my $number (@number) { print format_number($number) . "\n"; } use Nu

Re: How initialize hash inside a while loop ?

2002-07-30 Thread Jean Berthold
Hello Jeff, In fact, As you seen .. I'm newbie in Perl (in english too !) I'm just trying to translate a korn-shell script to perl-script for learning I try to use hashes like structs in C language, is it possible ? I search an easy way like: declare a struct an put it's reference in an arr

Re: Classic text problem: matching consecutive newlines

2002-07-30 Thread Steve Grazzini
Kevin Zembower <[EMAIL PROTECTED]> wrote: > I'm facing what I believe to one of the classic text manipulation > problems, transforming a document which was typed with a hard return > at the end of every physical line, and two consecutive newlines to > mark the end of a paragraph. > > Would anyo

Re: Please help

2002-07-30 Thread Sudarshan Raghavan
On Mon, 29 Jul 2002, Ning luo wrote: > > Hi Sir > > I have a perl script using system function, like > system("perl goup 1>basicName.scan 2>basicName.err"); > > goup is another perl script, what I want to do is executing goup, then print > the results to the file basicName.scan, if it abo

Re: Please help

2002-07-30 Thread Ramprasad A Padmanabhan
the outputs of a program can be to STDOUT or STDERR ( and also to files it opens internally ) On unix like systems STDOUT is known by &1 STDERR by &2 The output of a program on STDOUT goes wherever 1 is directed to similarly for STDERR 2 If U want to redirect STDERR to STDOUT use 2>&1 eg. pr

Re: Problem with Net::Ping

2002-07-30 Thread Sudarshan Raghavan
On Tue, 30 Jul 2002, Angerstein wrote: > Hello, > I wrote a big skript which uses net::ping (ping.pm) (and tk). > I noticed that the resultes of Net::Ping are not identical to the system > commad ping. > Much more Items are not reachable over Net::Ping then they are over the > system command. Th

Re: Help, I suppose.

2002-07-30 Thread Steve Grazzini
T?mas gu?mundsson <[EMAIL PROTECTED]> wrote: > > I need help ( you figure ?) > > #!/usr/bin/perl > use strict; > use Cwd; > > my $phone_book = qw{ ^ THat should be '@phone_book' (or '%phone_book', really.) A list-in-scalar-context (my $var = qw/foo bar/;) evaluates to the last element of

Problem with Net::Ping

2002-07-30 Thread Angerstein
Hello, I wrote a big skript which uses net::ping (ping.pm) (and tk). I noticed that the resultes of Net::Ping are not identical to the system commad ping. Much more Items are not reachable over Net::Ping then they are over the system command. I can´t explain why. (Even after rewriting 500 lines of

Please help

2002-07-30 Thread Ning luo
Hi Sir I have a perl script using system function, like system("perl goup 1>basicName.scan 2>basicName.err"); goup is another perl script, what I want to do is executing goup, then print the results to the file basicName.scan, if it abort abnormally print the error message to file basicNa

WINNT

2002-07-30 Thread Omar Shariff
Hi, i'm having problems with WIN NT, oracle and DBI, i write a script use DBI; $cta = 85498932; my $dbh = DBI->connect("dbi:Oracle:para_lelos", "gonzalo", "pepepepe") or die "No se puede establece la coneccion $data_source: $DBI::errstr"; my $sth = $dbh->prepare(q{SELECT * FROM

Re: Any better way to make 1000000 becomes 1,000,000 ?

2002-07-30 Thread Felix Geerinckx
on Tue, 30 Jul 2002 07:12:30 GMT, [EMAIL PROTECTED] (Connie Chan) wrote: > I have this script to make an integer with comma at every 3 > digits, from right to left. (What should this presentation way > name actaully ?? ) Like 123456 will becomes 123,456. Is there > anyway can making this simpler

RE: Any better way to make 1000000 becomes 1,000,000 ?

2002-07-30 Thread Beau E. Cox
Connie - Try this (not really much better) from Perl Cookbook #2.17: use strict; use warnings; my $num = commify (1_000_000); print "$num\n"; sub commify { my $text = reverse $_[0]; $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; return scalar reverse ($text); } Aloha

Sort table with dynamic order of fields

2002-07-30 Thread Connie Chan
In Excel, there is an interesting function which can sort a table by fields with any order and hierarchy order. Is there any module can do this for whatever array of array, hash of array... etc. ? But what I am looking for is not for and related to any database. So some of DBI functions maybe n