Counting and sorting an array

2001-05-17 Thread Kenan
Hi , I would like to sort an array like this my @pets = {$cat, $dog,$camel,$camel,$camel,$dog} and then to have it printed out in the order of occurrences print "I will give you <3> camels, <2> dogs, <1> cat " for the blond one Tnx Kenan

Re[2]: flush - ?

2001-05-17 Thread k
> > Question: What is "flush"? and how can a filehandle be flushed? I saw > > such a phrase while looking for info about file locking. > > If you would rather have every byte sent down that pipeline without > buffering, you can set a filehandle as unbuffered with the following: > > my prev = s

email headers

2001-05-17 Thread Chip Wiegand
I have written a form to email parser and have it working fine, the response page is a formatted html table which looks quite nice. I want to have the same table emailed to a person in my company, but the mail shows the html code, not the formatted table. I found out the problem is the message

Re: Use of uninitialized value in string eq atI:\Inetpub\wwwroot\PL1\cgi-bin\members_admin.pl line 66.

2001-05-17 Thread bmccoy
On Thu, 17 May 2001, Davidhayesmoats wrote: > I have a perl script running and i keep getting this error message: > Use of uninitialized value in string eq at >I:\Inetpub\wwwroot\PL1\cgi-bin\members_admin.pl line 66. > > The code from that area is: > > # decide task according to mode > > if ($mo

Use of uninitialized value in string eq at I:\Inetpub\wwwroot\PL1\cgi-bin\members_admin.pl line 66.

2001-05-17 Thread Davidhayesmoats
I have a perl script running and i keep getting this error message: Use of uninitialized value in string eq at I:\Inetpub\wwwroot\PL1\cgi-bin\members_admin.pl line 66. The code from that area is: # decide task according to mode if ($mode eq "menu") < line 66 { # Menu mode - Output

RE: matching question (real newbie...not like you fake newbies out th ere...)

2001-05-17 Thread King, Jason
Joel R Stout writes .. >I want to get the file names of all "EDI" files from a certain >directory. I >do not want "ENT" (or encrypted) file names. > >Example: > >The directory contains: >a001.edi >a002.edi >a003.edi.ent >a004.EDI > >After getting the file name in $_ I did the following match

Re: Using SSL and Perl to Gather Process Information

2001-05-17 Thread Matt Cauthorn
You may want to check this out: http://search.cpan.org/doc/BTROTT/Net-SSH-Perl-1.13/lib/Net/SSH/Perl.pm I bet this will get you where you want to go. ~Matt C. --- Ken Hammer <[EMAIL PROTECTED]> wrote: > > I need to write a perl script that will gather system information > from remote machine

DBD::Informix / java

2001-05-17 Thread Asim Memon
How do u install the DBD::Informix module...after i install it using MCPAN...theres always an error saying sth like wont make , wont install. DBI seems to be installed corrrectly, but when i write a simple program with just connecting to a database, it says that DBI::Informix may not be installed

Re: matching question (real newbie...not like you fake newbies out there...)

2001-05-17 Thread Shawn
/edi$/i I think? On 05/17, John Joseph Trammell rearranged the electrons to read: > On Thu, May 17, 2001 at 09:25:53PM -, Stout, Joel R wrote: > > if (/edi\b/i) { # thinking I would match file names 1, 2, and 4. Instead I > > matched on all. Wasn't \b supposed to help me out here? Or does

Re: matching question (real newbie...not like you fake newbies out there...)

2001-05-17 Thread John Joseph Trammell
On Thu, May 17, 2001 at 09:25:53PM -, Stout, Joel R wrote: > > I want to get the file names of all "EDI" files from a certain directory. I > do not want "ENT" (or encrypted) file names. > > Example: > > The directory contains: > a001.edi > a002.edi > a003.edi.ent > a004.EDI > > After ge

matching question (real newbie...not like you fake newbies out there...)

2001-05-17 Thread Stout, Joel R
I want to get the file names of all "EDI" files from a certain directory. I do not want "ENT" (or encrypted) file names. Example: The directory contains: a001.edi a002.edi a003.edi.ent a004.EDI After getting the file name in $_ I did the following match: if (/edi\b/i) { # thinking I would

RE: Win32::OLE SaveAs functions problem

2001-05-17 Thread Peter Cornelius
I haven't worked with the OLE modules at all but I'll put in my 2 cents. It's not clear to me that $filename is open from this snippet. It looks like $filename gets defined and then you delete it if it's there and is a regular file. I don't know what the SaveAs method does but I'm guessing it sa

RE: help with arrays

2001-05-17 Thread Peter Cornelius
>is it possible to read in this file and what ever is before the : would >become the name of >the array? > >IE: >I add this to the config file >full:apple grape chestnut What you're describing sounds like a symbolic reference which would give you something like... ($arrayName, $stuff) = (split

Re: Arrays of hashes?

2001-05-17 Thread M.W. Koskamp
- Original Message - From: David H. Adler <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, May 17, 2001 7:13 PM Subject: Re: Arrays of hashes? (...) > Technically, that's not *literally* possible. But you can have an array > of *references* to hashes (as assoc. arrays tend

Re: Help - Rookie question on Arrays

2001-05-17 Thread Brett W. McCoy
> How can I find out if an array contains a particular element stored in a > certain variable ? > > eg variable TEST1 = "030" > > array HOLDER = "020 040 034 056 030" > > I need to find out if "030" is present in the array HOLDER You can do it a couple of ways (there's ALWAYS more than one way to

RE: Help - Rookie question on Arrays

2001-05-17 Thread Wagner-David
Better point would be use hash % then you could use the number as a key into the array like if ( defined $Holder{$TEST1} ) { # found, so do something }else { # not found do something } so you could do: my %HOLDER = ('020', 1, '040', 1, '034', 1, '056', 1, '030', 1); if ( defined

Re: Help - Rookie question on Arrays

2001-05-17 Thread Paul
--- a p <[EMAIL PROTECTED]> wrote: > Hi, Hi. =o) > Today is my first day on Perl so please bear with me if this sounds > stupid... lol -- welcome aboard, and don't worry about it. Just be sure to do this: perldoc -t perl >tmp and then look at tmp to see the things you can look at in more

Re: Help - Rookie question on Arrays

2001-05-17 Thread Peter Cline
Perl has a foreach loop that is very apt at doing what you want. i.e. #!/usr/local/bin/perl5 $test1 = "030"; @holder = qw(020 040 034 056 030); foreach (@holder) { $test = true if ($_ == $test1); } This loop cycles through each element of the array, temporarily housing it in the special

Re: Arrays of hashes?

2001-05-17 Thread Paul
--- "David H. Adler" <[EMAIL PROTECTED]> wrote: > On Thu, May 17, 2001 at 12:08:56PM -0500, John Storms wrote: > > Is it possible to have an array of associative arrays? > > Technically, that's not *literally* possible. But you can have an > array of *references* to hashes (as assoc. arrays ten

Help - Rookie question on Arrays

2001-05-17 Thread a p
Hi, Today is my first day on Perl so please bear with me if this sounds stupid... How can I find out if an array contains a particular element stored in a certain variable ? eg variable TEST1 = "030" array HOLDER = "020 040 034 056 030" I need to find out if "030" is present in the array HO

Win32::OLE SaveAs functions problem

2001-05-17 Thread Chris Tréfois
Hi, I tried a lttle bit to get used to Win32::OLE And also searched tutorials on the Web. I found an interesting one, but at this part in the code I get stuck... --- CODE //some sutff $filename = 'd:\apache\apache\cgi-bin\perl2.xls'; unlink $filename if -f $filename; $workbook->Sav

RE: help with arrays

2001-05-17 Thread Jeff Pinyan
On May 17, Yacketta,Ronald J said: >backint:maple aspen pine >online:orange palm cherry > >is it possible to read in this file and what ever is before the : would >become the name of >the array? The key is, DON'T DO THAT. Don't make arrays with names you don't know ahead of time. It's best to

RE: help with arrays

2001-05-17 Thread Yacketta,Ronald J
Peter, Is it possible to-do this? in the config file I have (as you have seen b4) backint:maple aspen pine online:orange palm cherry is it possible to read in this file and what ever is before the : would become the name of the array? IE: I add this to the config file full:apple grape chestn

Can I talk to a 4D database?

2001-05-17 Thread William Akey
Hi. This is my first posting to this list. I hope someone can lend me a hand with some info. I would like to be able to directly interact with A 4D database using Perl's DBI module. Have any of you done this successfully? It is not clear to me which database driver I need. I suspect it is DBD::O

Re: doubt about $ in perldoc perlvar

2001-05-17 Thread Jeff Pinyan
On May 17, [EMAIL PROTECTED] said: > $ > Contains the subpattern from the corresponding set > of parentheses in the last pattern matched, not > counting patterns matched in nested blocks that have > been exited already. (Mnemonic: like \digits.

Re: doubt about $ in perldoc perlvar

2001-05-17 Thread Jos I Boumans
Sure, just try running these 2 bits of code and you'll see what that means: ### example 1 ### $foo = 'bar'; $foo =~ /(bar)/; $firstmatch = $1; $foo =~ /(quux/; $secondmatch = $1; print "$firstmatch and $secondmatch\n"; ### example 2 ### $foo = 'bar'; { $foo =~ /(bar)/; $firstmatc

Re: Arrays of hashes?

2001-05-17 Thread Brett W. McCoy
On Thu, 17 May 2001, John Storms wrote: > Is it possible to have an array of associative arrays? Sure. Just stick hashrefs into each array element: my @array = ( { name => 'Jim', location => 'Buffalo' }, { name => 'Bill', location => 'Boston' } ); T

Re: Getting options from the command line

2001-05-17 Thread Brett W. McCoy
> I am still very much the newbie, but to my untrained mind, > this completely blows away getopts. Getopt is a lot more flexible than the -s switch. I agree that -s is fine for basic stuff, but for more complicated command-line parsing (like switch bundling, or forcing a mandatory datatype), you

Re: Arrays of hashes?

2001-05-17 Thread David H. Adler
On Thu, May 17, 2001 at 12:08:56PM -0500, John Storms wrote: > Is it possible to have an array of associative arrays? Technically, that's not *literally* possible. But you can have an array of *references* to hashes (as assoc. arrays tend to be called nowadays). You should take a look at perl

Re: help with arrays

2001-05-17 Thread Timothy Kimball
: the above works fine and dandy (I think) : but when I replace the print in the for() with a system call as such : system "mminfo -a -r \"volume,mediarec,ssid,name\" -q \"location=sun_etl\" : -V -o tR -c $_ >> out"; : I get a broken pipe and the output from the mminfo command is spewed on the :

RE: help with arrays

2001-05-17 Thread Peter Cornelius
just an offhand guess but when I've run into this it's been an unsuspected new line. Try adding a chomp $line to the top of the while loop. Peter C.

help with arrays

2001-05-17 Thread Yacketta,Ronald J
Hello all!! here is my little problem, I have a file that I must parse and then once parsed I need to run a legato networker mminfo command to generate a list of save set id's to use for a cloning process. the config file looks like such backint:maple oak pine aspen online:palm chestnut cherry a

doubt about $ in perldoc perlvar

2001-05-17 Thread Atul_Khot
Gurus, perldoc perlvar says: $ Contains the subpattern from the corresponding set of parentheses in the last pattern matched, not counting patterns matched in nested blocks that have been exited already. (Mnemonic: like \digits.)

Arrays of hashes?

2001-05-17 Thread John Storms
Is it possible to have an array of associative arrays? --- [EMAIL PROTECTED] (Galactic Hero) Diplomacy: The art of saying good doggie while searching for a big rock.

Re: #!/usr/local/bin/perl

2001-05-17 Thread David H. Adler
On Thu, May 17, 2001 at 10:12:45AM +1000, King, Jason wrote: > > I just wanted to clarify that most Windows programs don't need the shebang > line at all .. windows works off filename extensions - not shebang lines > > so it's only really important under Apache in Windows which still requires a

Re: String concatenation in ?: structure.

2001-05-17 Thread Jeff Pinyan
On May 17, Peter Cornelius said: >$returnCode eq "o.k." ? $subject .= " -OK-" : $subject .= " -FAILED-"; You're being bitten by precedence. ?: is stronger than .=, so your code is like: ($foo == 1 ? $bar .= "this" : $bar) .= "that"; Which means that if $foo is 1, $bar gets "thisthat" tacked

Re: Getting options from the command line

2001-05-17 Thread Bkwyrm
I don't know if this will help at all, but I just found out, myself, about the -s option. If you run your script with: #!/usr/bin/perl -s and remember, to keep strict happy, to: use vars qw($all_the $variables $you_need $from_stdin); You can run your script like this: bash-2.03$ script.pl -varia

String concatenation in ?: structure.

2001-05-17 Thread Peter Cornelius
I use the tertiary conditional all the time but I just got some inexplicable behavior and wanted to see what the group had to say. I have a bit of code... my $subject = "Status"; my $returnCode = "o.k."; print "$subject\n"; $returnCode eq "o.k." ? $subject .= " -OK-" : $subject .= " -FAILED-";

Re: Getting options from the command line

2001-05-17 Thread Brett W. McCoy
On Thu, 17 May 2001, Craig Moynes/Markham/IBM wrote: > I tried using the getopts, and getopt but I can't seem to have mandatory > parameters with optional parameters. > I have something like this for my usage > perl scp_logs.pl -u username -h hostname -l local_directory [-r > remote_directory] S

Re: Getting options from the command line

2001-05-17 Thread Paul
--- Craig Moynes/Markham/IBM <[EMAIL PROTECTED]> wrote: > I tried using the getopts, and getopt but I can't seem to have > mandatory parameters with optional parameters. > I have something like this for my usage > perl scp_logs.pl -u username -h hostname -l local_directory [-r > remote_directory]

Getting options from the command line

2001-05-17 Thread Craig Moynes/Markham/IBM
I tried using the getopts, and getopt but I can't seem to have mandatory parameters with optional parameters. I have something like this for my usage perl scp_logs.pl -u username -h hostname -l local_directory [-r remote_directory] Any thoughts on ways to manually parse the parameteres from @ARG

Re: Compare statement.

2001-05-17 Thread Jos Boumans
well, actually you cant *just* use || instead of or, seeing || binds tighter... just try running this bit of code, and you'll see what i mean: if($c || $d = 2) { print "foo" } thus, if you use || and you wish to compare like you do, you *have* to use parens correct code would therefor be if($a

Re: Compare statement.

2001-05-17 Thread Paul
--- Doug Johnson <[EMAIL PROTECTED]> wrote: > Is there a better way to write: > my $x = "return"; > if (($x = "a") > || ($x = "test" ) > || ($x = "return" ) > || ($x = "x-retun")) >{ >print("bunch of foo); >} Several =o) [and my apologies for the reformat, but I needed to fit i

Re: flush - ?

2001-05-17 Thread Paul
--- kosta <[EMAIL PROTECTED]> wrote: > Question: What is "flush"? and how can a filehandle be flushed? I saw > such a phrase while looking for info about file locking. Most filehandles are buffered by default, which means they don't bother doing IO to the disk/socket/whatever until they have a b

Re: Array Question

2001-05-17 Thread Paul
--- jane doe <[EMAIL PROTECTED]> wrote: > How do I remove duplicate items from an array? I apologize for being > a "newbie". :) my @a = (1,2,2,3,4,4,5); my %h; @h{@a} = (); # hash keys are unique @a = sort keys %k; The line @h{@a} =(); is a bulk assignment of all elements of @a as keys in hash

Re: Variable Creation

2001-05-17 Thread Peter Scott
At 11:34 AM 5/17/2001 +0100, Alberto Manuel Brandao Simoes wrote: >On Thu, May 17, 2001 at 11:23:00AM +0200, Jos Boumans wrote: >( Alberto, >( >( let's start with something very basic: >( DO NOT use variables as variable names! >( > Let's see if I can explain what I'm doing. I'm writing a

Re: Variable Creation

2001-05-17 Thread Peter Scott
At 09:03 AM 5/17/2001 +0100, Alberto Manuel Brandao Simoes wrote: > Hellows > > I'm writing a module and, as all modules should be, I'm using > strict. So, I >need to 'declare' every variable. What I want, is to do something like: > > $varname = "myvar"; > @$varna

RE: Compare statement.

2001-05-17 Thread Doug Johnson
Yea there are a lot of values and if I go back and look at my code I do have eq instead of the =. I still had the multiple parens though. I was thinking that the comparison may hold true when it crosses the "or" statement without the parenthesis. I will give the hash a try and let you know if I h

Re: Compare statement.

2001-05-17 Thread Jeff Pinyan
On May 17, Doug Johnson said: >my $x = "return"; > >if (($x = "a") || ($x = "test" ) || ($x = "return" ) || ($x = "x-retun")) > { > print("bunch of foo); > } First, that's NOT the code you have. If it IS, it's broken. if ($x eq 'a' or $x eq 'test' or $x eq 'return' or $x eq 'x-retu

[ADV] Symbol Table (was Re: Variable Creation)

2001-05-17 Thread Jeff Pinyan
On May 17, Paul Johnson said: >You can't. You are trying to use symbolic references and when you have >strict turned on you are promising not to do that. >my $varname = "myvar"; >{ >no strict "refs"; >no strict "vars"; >@$varname = ('a','b','c'); >} It's important to know one thing

environment variable for LC_CTYPE

2001-05-17 Thread Jodi_L_Schatz
I received this warning for a script I was using when we switched from Sun 4.1 to Solaris: perl: warning: Set locale (LC_CTYPE, "") failed. perl: warning: LC_ALL = "(null)", LC_CTYPE = "en_US", LANG = "en_US" perl: warning: Falling back to the "C" locale. The LC_CTYPE is causing the problem, but

Re: flush - ?

2001-05-17 Thread Collin Rogowski
Normally all filehandles (except STDERR, I think) are buffered. That means that if you write a character (or a byte) on a filehandle, the system does not write it on the disk immediatly, but waits till it's buffer is full and than writes the whole buffer. This saves many IO-Operations, which resul

Compare statement.

2001-05-17 Thread Doug Johnson
Is there a better way to write: my $x = "return"; if (($x = "a") || ($x = "test" ) || ($x = "return" ) || ($x = "x-retun")) { print("bunch of foo); } Could my if comparison be made smaller? I would like to compare 1 value to a list without multiple "x =". Best Regards, Doug

Re: flush - ?

2001-05-17 Thread Brett W. McCoy
On Thu, 17 May 2001, kosta wrote: > Question: What is "flush"? and how can a filehandle be flushed? I saw > such a phrase while looking for info about file locking. Found in /usr/lib/perl5/5.6.1/pods/perlfaq5.pod How do I flush/unbuffer an output filehandle? Why must I do this?

Re: Location.

2001-05-17 Thread RS
Francis, how new are you to Perl. Im extremely new! --- Francis Henry <[EMAIL PROTECTED]> wrote: > me! > > RS wrote: > > > Kind of off topic but, is anyone in this list > located > > in NYC? > > > > = > > **R.S.** (pronounced R-dot S-dot) > > "Look at all the pretty C shells" > > > > _

Re: Location.

2001-05-17 Thread Steve Neu
: Kind of off topic but, is anyone in this list located : in NYC? Let's try to send responses to this directly to RS, and not to the list. Thanx, my inbox appreciates it! :-) Stephen Neu Internet Development Characterlink.net (630) 323-9800 ext. 235

Re: Location.

2001-05-17 Thread Francis Henry
me! RS wrote: > Kind of off topic but, is anyone in this list located > in NYC? > > = > **R.S.** (pronounced R-dot S-dot) > "Look at all the pretty C shells" > > __ > Do You Yahoo!? > Yahoo! Auctions - buy the things you want at great prices >

Location.

2001-05-17 Thread RS
Kind of off topic but, is anyone in this list located in NYC? = **R.S.** (pronounced R-dot S-dot) "Look at all the pretty C shells" __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/

flush - ?

2001-05-17 Thread kosta
hi! Question: What is "flush"? and how can a filehandle be flushed? I saw such a phrase while looking for info about file locking. thanks in advance, kosta

Re: Variable Creation

2001-05-17 Thread Jeff Pinyan
On May 17, Alberto Manuel Brandao Simoes said: >RULE ---> FILE* > >::t { > for (@FILE) { > #do something > } >} > >The idea is, when parsing the RULE, create the FILE array so that the user can >browse it. This is done by an eval, so I can construct a string initializing

Re: Perl - Cryptography

2001-05-17 Thread Brett W. McCoy
On Thu, 17 May 2001, Joel Divekar wrote: > Please I am looking for tutorials and mailing list on cryptography and also > on Hacking (to make our site secure) You mean, Cracking don't you? Hacking and cracking are different things. Take a look at the O'Reilly book _Practical Unix & Internet Sec

Perl - Cryptography

2001-05-17 Thread Joel Divekar
Hi Please I am looking for tutorials and mailing list on cryptography and also on Hacking (to make our site secure) Regards Joel -- QuantumLink Communications, Bombay, India

FW: FW: delete files

2001-05-17 Thread Porter, Chris
-Original Message- From: Porter, Chris Sent: Thursday, May 17, 2001 6:59 AM To: '[EMAIL PROTECTED]' Subject: RE: FW: delete files Thanks, helps very much. The directory -- I added the directory I'm referring to. opendir DIR - added the same directory() Can u break this code do

Re: Variable Creation

2001-05-17 Thread Alberto Manuel Brandao Simoes
On Thu, May 17, 2001 at 11:23:00AM +0200, Jos Boumans wrote: ( Alberto, ( ( let's start with something very basic: ( DO NOT use variables as variable names! ( Let's see if I can explain what I'm doing. I'm writing a 'compiler', well... interpreter for a grammar style language. There woul

Re: Variable Creation

2001-05-17 Thread Paul Johnson
On Thu, May 17, 2001 at 09:03:33AM +0100, Alberto Manuel Brandao Simoes wrote: > > Hellows > > I'm writing a module and, as all modules should be, I'm using strict. I trust you've got warnings turned on too. > So, I need to 'declare' every variable. What I want, is to do >

Re: Perl - Cryptography

2001-05-17 Thread Paul Johnson
On Thu, May 17, 2001 at 12:52:45PM +0530, Joel Divekar wrote: > Please I am looking for tutorials and mailing list on cryptography and also > on Hacking (to make our site secure) http://lists.perl.org/showlist.cgi?name=perl-crypto http://www.tuxedo.org/~esr/faqs/hacker-howto.html Oh! You mea

Re: Variable Creation

2001-05-17 Thread Jos Boumans
Alberto, let's start with something very basic: DO NOT use variables as variable names! seeing MJD already wrote a very nice piece about why that's a bad idea, i'll just refer you to his site: http://perl.plover.com/varvarname.html Now, what *should* you do? 1. if you want multiple values for

Re: passing part of an array to a function

2001-05-17 Thread Gary Stainburn
Thanks for that explanation Jason, I'm always happier when I know *why* something doesn't work. What I've ended up doing, and was also suggested in another branch of this thread was to pass a reference to the whole array, and a start and end index number. This appears to provide the fastest r

Cryptography

2001-05-17 Thread Joel Divekar
Hi Please I am looking for tutorials and mailing list on cryptography and also on Hacking (to make our site secure) Regards Joel -- QuantumLink Communications, Bombay, India

Perl - Cryptography

2001-05-17 Thread Joel Divekar
Hi Please I am looking for tutorials and mailing list on cryptography and also on Hacking (to make our site secure) Regards Joel -- QuantumLink Communications, Bombay, India

Variable Creation

2001-05-17 Thread Alberto Manuel Brandao Simoes
Hellows I'm writing a module and, as all modules should be, I'm using strict. So, I need to 'declare' every variable. What I want, is to do something like: $varname = "myvar"; @$varname = ('a','b','c'); This sets @myvar as I want, but how can I do this w

ODBC Driver for UNIXPLATFORM HP-UX 10.20

2001-05-17 Thread perl . mail
Hello, I need an ODBC driver for the OS HP-UX 10.20 ( Unixplatform ) Where I can download this driver, and what I am doing to install this driver? Thanks a lot Hasan Ügür -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net

Help on decoding!

2001-05-17 Thread Alejandro Martinez
Does anyone knows how to decode a Mail and attached file in different formats such as : (Txt, Html, pdf, ecc.). In case that no one knows how to do it in Perl, there is any program I can use to decode, or another language that I could integrate in a perl script. thanks for the help! Alejand