help with classes...

2002-12-10 Thread christopher j bottaro
hey, i'm a c/c++ programmer struggling to pick up OO perl. i've been reading the perltoot and i have question about the following: package Person; use strict; sub new { my $self = {}; $self->{NAME} = undef; $self->{AGE}= undef; $self->{PEERS} = []

Re: help with classes...

2002-12-10 Thread Paul Johnson
christopher j bottaro said: > hey, > i'm a c/c++ programmer struggling to pick up OO perl. i've been reading > the perltoot and i have question about the following: Hopefully it won't be too much of a struggle. In contrast to C++, there is little magic going on behind the scenes. Read the sta

How to get the biggest integers from an array?

2002-12-10 Thread Mystik Gotan
Hiya, I'm in search for a solution. Let's say I have this array: @array (5, 6, 7, 89, 1, 0, 456, 298023, 56); Now, how can I get the biggest integers from this array and give them a string with their place. Let's say I have a foreach loop where I checked all the biggest integers (however, I do

RE: Package Syntax

2002-12-10 Thread Bob Showalter
> -Original Message- > From: Jeff Westman [mailto:[EMAIL PROTECTED]] > Sent: Monday, December 09, 2002 10:49 PM > To: [EMAIL PROTECTED] > Subject: Package Syntax > > > I usually see the last line in a package as > >1; > > Does this force the package to compile without error? What

RE: How to get the biggest integers from an array?

2002-12-10 Thread Kipp, James
> > @array (5, 6, 7, 89, 1, 0, 456, 298023, 56); > > Now, how can I get the biggest integers from this array and > give them a > string with their place. Let's say I have a foreach loop > where I checked all > the biggest integers (however, I don't know how) and I give > them all a > string

Re: How to get the biggest integers from an array?

2002-12-10 Thread Sudarshan Raghavan
On Tue, 10 Dec 2002, Mystik Gotan wrote: > Hiya, Please do not cross post. > > I'm in search for a solution. Let's say I have this array: > > @array (5, 6, 7, 89, 1, 0, 456, 298023, 56); > > Now, how can I get the biggest integers from this array and give them a > string with their place. Le

Re: How to get the biggest integers from an array?

2002-12-10 Thread Jenda Krynicky
From: "Mystik Gotan" <[EMAIL PROTECTED]> > I'm in search for a solution. Let's say I have this array: > > @array (5, 6, 7, 89, 1, 0, 456, 298023, 56); > > Now, how can I get the biggest integers from this array and give them > a string with their place. Let's say I have a foreach loop where I > c

Re: help with classes...

2002-12-10 Thread Sheriff Gaye
Forwarded Message From:"christopher j bottaro" <[EMAIL PROTECTED]>Reply-to:[EMAIL PROTECTED]:[EMAIL PROTECTED]:help with classes...Date:Tue, 10 Dec 2002 04:45:15 -0600MIME-Version:1.0Content-Type:text/plain; charset="us-ascii"Content-Transfer-Encoding:7bitMessage-Id:<[EMAIL PROTECTED]> Plain T

RE: Using ssh for uptime?

2002-12-10 Thread Mark-Nathaniel Weisman
My box does not seem to have the Net::SSH::Perl installed. How can I get it installed? His Faithful Servant, Mark-Nathaniel Weisman President / CEO Infinite Visions Educational Systems Inc. Anchorage, Alaska http://www.ivedsys.com [EMAIL PROTECTED] -Original Message- From: zentara [mai

Formats

2002-12-10 Thread Dave Chappell
Title: Message Attached is one of a few (work in progress) scripts that I am creating to report on security events in a M$ network. The issue I am having is, the second format, STDBODY is not printing. Since STDBODY can contain many lines I even tried adding  ~~ to the fieldline as suggested

Code bar generator

2002-12-10 Thread Cleiton Luiz Siqueira
Dear, I'm looking for code bar generator in perl. Either someone knows where can I find one or sending me a example? Thanks in advance, -- Cleiton Luiz Siqueira Centro de Educação Monjolo Fone: 520-1915 http://www.colegiomonjolo.com.br -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additio

why error message?

2002-12-10 Thread Robbie Staufer
Hi, Can anyone tell me why this while loop would give me this error message? while ( ($id) = $sth->fetchrow_array) { $sth->execute(); @header_row = $sth->fetchrow_array; ## loop through the row array and print with comma space delimiters ## print two new lines at the end of the row for do

Re: Code bar generator

2002-12-10 Thread Fred Sahakian
http://www.fairfieldcomputers.com/barcode/docs.html Never used it though >>> Cleiton Luiz Siqueira <[EMAIL PROTECTED]> 12/10/02 09:56AM >>> Dear, I'm looking for code bar generator in perl. Either someone knows where can I find one or sending me a example? Thanks in advance, -- Cleiton Luiz

Re: why error message?

2002-12-10 Thread Mystik Gotan
Maybe you're trying to accomplish this: while ($id == $sth->fetchrow_array) { I'm pretty sure this will cause the error you're looking for. -- Bob Erinkveld (Webmaster Insane Hosts) www.insane-hosts.net MSN: [EMAIL PROTECTED] From: Robbie Staufer <[EMAIL PROTECTED]> To: [EMA

Re: Code bar generator

2002-12-10 Thread Fred Sahakian
This one is good, Ive played with it before and there are no modules to install: http://www.barcodemill.com/ >>> Cleiton Luiz Siqueira <[EMAIL PROTECTED]> 12/10/02 09:56AM >>> Dear, I'm looking for code bar generator in perl. Either someone knows where can I find one or sending me a example? T

Re: why error message?

2002-12-10 Thread Robbie Staufer
Thanks. Problem solved. Robbie Mystik Gotan wrote: > Maybe you're trying to accomplish this: > > while ($id == $sth->fetchrow_array) { > > I'm pretty sure this will cause the error you're looking for. > > -- > Bob Erinkveld (Webmaster Insane Hosts) > www.insane-hosts.net > MSN: [EM

automatic non-ftp download

2002-12-10 Thread William.Ampeh
Is anyone aware of a Perl module, script, etc. which can perform an automatic download (similar to lynx)? So say, I want to download and process the contents of the excel file at the following site: http://www.census.gov/indicator/www/m3/adv/table1a.xls With Perls' ParseExcel module, I am able t

first row of database

2002-12-10 Thread Robbie Staufer
Hi, Is there a way to refer to the first row of a database (row 0?) ? For example, the first row of my database contains header information. I want the header row to print out first whenever data is requested, so the output file looks like this: header, header, header, header, header data, data

Re: automatic non-ftp download

2002-12-10 Thread Jenda Krynicky
From: <[EMAIL PROTECTED]> > Is anyone aware of a Perl module, script, etc. which can perform an > automatic download (similar to lynx)? > > So say, I want to download and process the contents of the excel file > at the following site: > http://www.census.gov/indicator/www/m3/adv/

parse out parts of dir / files /

2002-12-10 Thread Johnson, Shaunn
Howdy: I'm having problems trying to parse out part of a directory into variables. I start with this: [snip script] /usr/local/bin/perl -w use diagnostics; my $dest="/i/'Depression Management'/Mailing/dec2002_iso_images"; # Where is data coming from? my $source="/i/'Depression Management'/Ma

Re: parse out parts of dir / files /

2002-12-10 Thread Rob Dixon
Hi Shaunn What exactly are you getting? because this looks like it should work, except that your value for $source doesn't match the directories listed in the results. A couple of points though. This won't work in general, because if $source contains any special regex characters then it will beha

Re: linked list's

2002-12-10 Thread Jason Tiller
Yo, Mark, On Mon, 9 Dec 2002, Mark Goland wrote: > Ok I got it working now, thanx much Jason. Only question I have is > regarding this. Good! Glad I could help. > $head ||= $link; This is a Perl idiom to set a variable if it hasn't already been set. So, if $head == undef, then $head will

RE: parse out parts of dir / files /

2002-12-10 Thread Perry, Alan
Not sure if this will help, but something like this would work... foreach ( `ls -d1 $source/06/*` ) { # each line of output goes into $_ @group = split(m|/|, $_); # split out filename parts $pcgname = pop(@group); # gets filename $bu = pop(@group); #

Putting output back in the same file it came from

2002-12-10 Thread Dylan Boudreau
Here is what I am trying to do. I want to read all the files in a directory searching for a specific string, if the string is found I want it to be either changed or deleted depending on what I enter as a replacement string. I know I can do it by putting the output to a separate file and then jus

Re: help with classes...

2002-12-10 Thread christopher j bottaro
thanks to both of yall for the explanations. so bless() is is where the magic happens? once something is given a type, then those subs become methods and a ref of the calling object is implicitly giving as the first arg? i see now, thats what i was missing before. everything is much more cle

GNU grep -C in Perl

2002-12-10 Thread Jerry Rocteur
Hi, Anyone know how to write a grep -C in Perl ? You know, I want to search for a string/regexp in a file and I want to print the line before and the line after the search string. I've tried a couple of ways and it takes a really long time, I load the file in memory, seach for the string, extr

Dynamic Array Names

2002-12-10 Thread Paul Kraus
I have an array that I want to generate a new hash for each item that is the first array. I want the new hashes to be named as the 1st array. Wow I am confused reading that. Example ... I am using Config::IniFiles I place all the sections from the ini file into an array. I then want a new hash fo

RE: Dynamic Array Names

2002-12-10 Thread Mark Anderson
> I have an array that I want to generate a new hash for each item that is > the first array. I want the new hashes to be named as the 1st array. Wow > I am confused reading that. Example ... Yes it is. > I am using Config::IniFiles I haven't used it, so I can't give you any module specific hel

Re: help with classes...

2002-12-10 Thread christopher j bottaro
hmm, i have more questions now. how does one make class methods vs object methods? using the example from the tutorial... package Person; use strict; sub new { my $self = {}; $self->{NAME} = undef; $self->{AGE}= undef; $self->{PEERS} = [];

Re: GNU grep -C in Perl

2002-12-10 Thread Larry Coffin
>Anyone know how to write a grep -C in Perl ? Why not just store the previous line, then when you have a match, print it, the matching line, then set a flag to print the next line as well? Something along the lines of: while ($line = ) { if ($print_next) {

Re: GNU grep -C in Perl

2002-12-10 Thread Jerry Rocteur
Hi, Reading further in the archives to this list I got an idea: (thanks to John W. Krahn) #!/usr/bin/perl $pattern = shift(@ARGV); while (<>) { if ( /$pattern/i ){ print $reml; print $_; $_ = <>; print "$_\n"; }

RE: GNU grep -C in Perl

2002-12-10 Thread Hanson, Rob
Another option would be to use the Perl version of grep from the PPT (Perl Power Tools) project. PPT Home http://www.perl.com/language/ppt/ tcgrep Source http://www.perl.com/language/ppt/src/grep/tcgrep tcgrep Perldoc http://www.perl.com/language/ppt/src/grep/tcgrep.html Rob -Original Mes

Re: help with classes...

2002-12-10 Thread wiggins
I assume you have done your required reading: in the perldocs: perlbootPerl OO tutorial for beginners perltootPerl OO tutorial, part 1 perltootc Perl OO tutorial, part 2 perlobj Perl objects perlbot

RE: Putting output back in the same file it came from

2002-12-10 Thread Bob Showalter
> -Original Message- > From: Dylan Boudreau [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, December 10, 2002 3:04 PM > To: [EMAIL PROTECTED] > Subject: Putting output back in the same file it came from > > > Here is what I am trying to do. I want to read all the files in a > directory searc

Re: parse out parts of dir / files /

2002-12-10 Thread John W. Krahn
Shaunn Johnson wrote: > > Howdy: Hello, > I'm having problems trying to parse out part > of a directory into variables. > > I start with this: > > [snip script] > > /usr/local/bin/perl -w > use diagnostics; > > my $dest="/i/'Depression Management'/Mailing/dec2002_iso_images"; > > # Where is

Re: Putting output back in the same file it came from

2002-12-10 Thread John W. Krahn
Dylan Boudreau wrote: > > Here is what I am trying to do. I want to read all the files in a > directory searching for a specific string, if the string is found I want > it to be either changed or deleted depending on what I enter as a > replacement string. I know I can do it by putting the outpu

Re: first row of database

2002-12-10 Thread Jeff Westman
If you are using Oracle 8.i or greater, you can do: select * from yourTable where rownum < 2 JW --- Robbie Staufer <[EMAIL PROTECTED]> wrote: > Hi, > > Is there a way to refer to the first row of a database (row 0?) ? > > For example, the first row of my database contains header infor

Re: GNU grep -C in Perl

2002-12-10 Thread Jason Tiller
Hi, Jerry, :) On Tue, 10 Dec 2002, Jerry Rocteur wrote: > Anyone know how to write a grep -C in Perl ? Here is a script that mimics just the '-C' feature of GNU grep. It doesn't support the fanciness of printing filenames when multiple input files are specified. This may be overkill for your s

Return Status

2002-12-10 Thread Paul Kraus
instead of setting my own $error can I instead just check if &mount completed ok? Is there a better way to do this? Code Snip - Foreach loop ... &mount; next if ($error == 1); mkdir "//backup/$ini{$section}{machine}" unless (-e "/backup/$ini{$section}{machin

Re: GNU grep -C in Perl

2002-12-10 Thread John W. Krahn
Jerry Rocteur wrote: > > Hi, Hello, > Anyone know how to write a grep -C in Perl ? Yes, someone definitely does: http://www.perl.com/language/ppt/src/grep/index.html > You know, I want to search for a string/regexp in a file and I want to > print the line before and the line after the search

RE: Return Status

2002-12-10 Thread Hanson, Rob
Yes, just return a true (1) or false (0) value... foreach (@junk) { next unless mount(); # next on error ... do stuff ... } sub mount{ ... do stuff ... return $return_code; } ...OR... sub mount{ ... do stuff ... # return the negated return value return ! system(...); } ...OR...

Re: Return Status

2002-12-10 Thread Jeff 'japhy' Pinyan
On Dec 10, Paul Kraus said: >instead of setting my own $error can I instead just check if &mount >completed ok? Is there a better way to do this? Sure. >sub mount{ >!system >"mount","-t","smbfs","-o","username=$ini{$section}{username},password=$i >ni{$section}{password}", > >"//$ini{$sec

Re: help with classes...

2002-12-10 Thread Todd W
"Christopher J Bottaro" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hey, > i'm a c/c++ programmer struggling to pick up OO perl. i've been reading the > perltoot and i have question about the following: > > package Person; > use strict; > > sub new

expenses

2002-12-10 Thread nyec
Here it is in CSV (comma separated values). it's not very much - $246 Date,Amount,Description,Location 10.08.02,100.52,"Business Cards - Mark, Me",Designyourowncard.com 10.22.02,50.26,Business Cards - Lorraine,Designyourowncard.com 10.22.02,31.28,Lunch - Mark & Lorraine,Claim Jumper 10.25.02,64.60,

Re: help with classes...

2002-12-10 Thread Todd W
"Christopher J Bottaro" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hmm, i have more questions now. how does one make class methods vs object > methods? > > using the example from the tutorial... > sub name { > my $self = shift; > if (@

Re: GNU grep -C in Perl

2002-12-10 Thread John W. Krahn
"John W. Krahn" wrote: > > my $before = 1; > my $after = 1; > my @buffer; > > while ( my $line = ) { > > push @buffer, $line; > > shift @buffer if $#buffer > $before + $after; > > next if $#buffer < $before; > > if ( $buffer[ $before ] =~ /found matching regex/ ) { > >

Re: Dynamic Array Names

2002-12-10 Thread Wiggins d'Anconia
Mark Anderson wrote: No you don't. Sorry. Someone else hopefully will post the link to the column that someone wrote that would tell you why. Are you referring to the following: http://perl.plover.com/varvarname.html Came across it in my other travels looking for information about forki

RE: Using ssh for uptime?

2002-12-10 Thread chad kellerman
Mark, This is a pain to install. I would do it thru CPAN. perl -MCPAN -e shell cpan>install Net::SSH::Perl I fyou don't have root access to install perl modules, try to use Net::SSH. use strict; use warnings; use Net::SSH qw( sshopen3 ); my $user = "bob"; my $host = "10.10.10.10"; my $

RE: How to get the biggest integers from an array?

2002-12-10 Thread Beau E. Cox
I'm not sure I understand your whole question, but the easiest way to find the largest integers is to sort your array in reverse numeric order: my @array (5, 6, 7, 89, 1, 0, 456, 298023, 56); my @sorted = sort {$b <=> $a } @array; Now @sorted should contain: (298023, 456, 89, 56, 7, 6, 5, 1, 0)

Re: How to get the biggest integers from an array?

2002-12-10 Thread Paul Johnson
Mystik Gotan said: Careful with the crossposting. This has nothing to do with CGI, and I don't suppose my post will even get to the yahoo list. > I'm in search for a solution. Let's say I have this array: > > @array (5, 6, 7, 89, 1, 0, 456, 298023, 56); > > Now, how can I get the biggest intege

Re: How to get the biggest integers from an array?

2002-12-10 Thread R. Joseph Newton
Try making a numberLposition hashas you iterate through the array, add each number as a key and the position in the array as the value. Then use sort($keys(%hash)) to order them. I'm a newbie, also, so I'm not sure if sort has an optional parameter for order, though. You'll have to explore th

Re: How to get the biggest integers from an array?

2002-12-10 Thread Geraint Jones
Use the sort function: print sort @array; and for largest number first use: print reverse sort @array; For your particular problem: @sorted_array = reverse sort @array; foreach (@sorted_array) { # whatever you want to do with each number

Re: How to get the biggest integers from an array?

2002-12-10 Thread Mystik Gotan
Oh, no, actually, I know quite about Perl. The problem is, I hardly have got any experience in programming, I read a lot. I've got 3 perl books and wasn't just thinking at the idea of using sort(). Thanks guys. -- Bob Erinkveld (Webmaster Insane Hosts) www.insane-hosts.net MSN: [EM

Net::SMTP::Server

2002-12-10 Thread Tom Allison
Any idea how you return an exitcode after the $client->process step is completed? According to the perldoc, there isn't really any way to do this. I'm hoping for a loophole of sorts. -- FORCE YOURSELF TO RELAX! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAI

Which package am I in ?

2002-12-10 Thread Trond Hagen
Hi! I want to know which package I'm in? Any help? package go print "Now I'm here: ??PACKAGE??\n" # <- ??PACKAGE?? can be replaced by? Thanks! :-) trond -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Which package am I in ?

2002-12-10 Thread Tanton Gibbs
perldoc -f caller - Original Message - From: "Trond Hagen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 11, 2002 1:09 AM Subject: Which package am I in ? > Hi! > > I want to know which package I'm in? > Any help? > > package go > > print "Now I'm here: ??PACKA