Re: Multiple Key,Value Pairs?

2001-12-28 Thread Michael R. Wolf
"Jonathan E. Paton" <[EMAIL PROTECTED]> writes: > %hash('james' => ['1', '2'], > 'kelty' => '3', > 'biran' => '4'); > > When accessing the keys you check for an array ref, if so > you have multiple values. More memory and you can just > create each value as an array. And if you wan

Re: Good CS Literature

2001-12-28 Thread Michael R. Wolf
Luke <[EMAIL PROTECTED]> writes: > I bought the Learning Perl by Orielly but I returned it > after realizing thats its almost the same as > perldoc/manuals... "Learning Perl" is a tutorial perldoc is a reference [...] > My problem with programming is that i dont know if im > doing the right th

Re: I need your help

2001-12-28 Thread Leon
- Original Message - From: "Jose Vicente" <[EMAIL PROTECTED]> > Hi friends. > I am replacing a string using s///, in the following way:, but I only > need and exact string to be replaced, for example if I have a file with the > following strins: > amor > alto > a > bacho > And execute

Re: Question!! number of line....

2001-12-28 Thread Leon
- Original Message - From: "Mark Mclogan" <[EMAIL PROTECTED]> > How I can know in that I number of line finds a word in a text file?. > For example, a file "file.txt" contains the following list: > > Chocolate > Cake > Cheese > Apple > orange > melon > lemon > > How I can know in that l

Re: I need your help

2001-12-28 Thread Connie Chan
if you are reading these string from a file, I suppose there is a \n at eol... so. how about like this ? ~s/^$name\s/\#$name/g have a nice day =) - Original Message - From: "Jose Vicente" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, December 29, 2001 9:26 AM Subject:

RE: I need your help

2001-12-28 Thread Daryl J. Hoyt
How about: if($string eq $name) { $string = "#".$string; } Daryl J. Hoyt Performance Engineer Geodesic Systems 312-832-2010 -Original Message- From: Jose Vicente [mailto:[EMAIL PROTECTED]] Sent: Friday, December 28, 2001

I need your help

2001-12-28 Thread Jose Vicente
Hi friends. I am replacing a string using s///, in the following way:, but I only need and exact string to be replaced, for example if I have a file with the following strins: amor alto a bacho And execute ~s/$name/#$name/g where $name is equal to "a", so I have #amor #alto #a b#acho But I

RE: writing to a file

2001-12-28 Thread Johnson, Shaunn
Howdy: You're not talking about something like THIS, are you? [snip example] open DATE, "date +%H:%M"; $date=; chop $date; [/snip example] And as I look at it, I'm thinking that might not be right. I just modified this (like two seconds ago from this: [snip] open DATE, "date |"; $date=; ch

RE: writing to a file

2001-12-28 Thread Lance Prais
Does anyone know how to grab the server time to include it in a file? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

writing to a file

2001-12-28 Thread Lance Prais
If I want to write to a log file to track errors. 1. Open the file 2. Write to the file 3. Close the file Is that the correct psudo-code -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Multiple Key,Value Pairs?

2001-12-28 Thread Jonathan E. Paton
> This is my normal structure for a hash array, but I > was wondering if it was possible to have multiple > values for a key? I.e. > > %hash('james' => '1', > 'james' => '2', > 'kelty' => '3', > 'biran' => '4'); No, a hash is a 1 to 1 relationship between key and value. Howeve

Re: Multiple Key,Value Pairs?

2001-12-28 Thread Curtis Poe
--- James Kelty <[EMAIL PROTECTED]> wrote: > Below is a hash array... > > %hash('james' => '1', > 'kelty' => '2', > 'brian' => '3'); > > This is my normal structure for a hash array, but I was wondering if it was > possible to have multiple values for a key? I.e. > > %hash('james' =

Multiple Key,Value Pairs?

2001-12-28 Thread James Kelty
Below is a hash array... %hash('james' => '1', 'kelty' => '2', 'brian' => '3'); This is my normal structure for a hash array, but I was wondering if it was possible to have multiple values for a key? I.e. %hash('james' => '1', 'james' => '2', 'kelty' => '3',

Conf or Properties files...

2001-12-28 Thread James Kelty
I have found two modules ConfReader::Simple and Config::Properties for creating and reading configuration files. I have decided to create a file with things like the domain name and port information of certain hosts I intend to monitor. Which of these two modules would be best? Is there another mo

Perl scripts for Oracle on Unix

2001-12-28 Thread Edwin Davidson
I have one single Oracle table with 6-7 fields in it. I need a HTML form with a few text fields for people to fill in and a Perl script to yield matching records based upon what people enter in. Is there someone who has this or somewhere on the web I can get this ? Thank you. Edwin -- To

Re: Question for those familiar with imagemagick for perl

2001-12-28 Thread Joelmon2001
Ok, the first error was the exact error. That's all it stated I am on linux Raq 3 Perl 5.05 The original error was a software error that I posted before now the internal error I get after the recommendation from you and another helpful poster. That internal error is this: Internal Server Erro

RE: @INC

2001-12-28 Thread McCollum, Frank
Rob Hanson sent this to me the other day when I asked a similar question. I had been using "-I C:/Path/Of/Library/" (I was later informed that this was more for use when using in-house modules) in the first line of my scripts, but he listed some alternatives that maybe more appropriate - see belo

@INC

2001-12-28 Thread David Kirol
Hi All, This is one of those posts: 'How would I do this if I were a real perl programmer...' First, the problem. Windoz NT with Apache server (windoze version) and cygwin with perl 5.6.1 (NOT activestate). Apache is configured for CGI and perl can find CGI.pm in cygwin and windoz shell b

RE: Question!! number of line....

2001-12-28 Thread SathishDuraisamy
require 5; sub get_line_num { my ($file_name, $string_to_look_for) = @_; my $line_num = -1; open ( MYFILE, $file_name ) or die "Error opening file '$file_name'. Reason is <$!>"; while ( ) { if ( /$string_to_look_for/i ) { $line_num = $.; last; } } close( MY

RE: Question!! number of line....

2001-12-28 Thread Bob Showalter
> -Original Message- > From: Mark Mclogan [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 28, 2001 4:37 PM > To: [EMAIL PROTECTED] > Subject: Question!! number of line > > > > How I can know in that I number of line finds a word in a text file?. > For example, a file "file.txt"

Question!! number of line....

2001-12-28 Thread Mark Mclogan
How I can know in that I number of line finds a word in a text file?. For example, a file "file.txt" contains the following list: Chocolate Cake Cheese Apple orange melon lemon How I can know in that line number is the Apple word? Over MMClogan __

Re: [SOLVED] DBI fetchrow_hashref(), pointers & references

2001-12-28 Thread Filip Sneppe
Ok, sorry, I just found out I can also use fetchrow_array()... - Original Message - From: "Filip Sneppe" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 28, 2001 8:59 PM Subject: DBI fetchrow_hashref(), pointers & references > Hi, > > I use perl to access a MySQL data

Accessing scratchpad variables with Inline::C

2001-12-28 Thread Curtis Poe
Okay, this is not exactly a beginner's question, but I can't seem to find an answer to this anywhere. Does anyone have any samples of XS, SWIG, or Inline::C code (preferably the latter) that accesses scratchpad variables? I've looked and can't seem to find any. Reading through the Perl sourc

DBI fetchrow_hashref(), pointers & references

2001-12-28 Thread Filip Sneppe
Hi, I use perl to access a MySQL database, and I have to make a lot of fairly easy queries, like these: "select sourceip, sum(bytes) as sumbytes from traffic" "select destip, sum(bytes) as sumbytes from traffic" and then put the numbers in an html table. The code that retrieves the data f

RE: Output to email

2001-12-28 Thread SathishDuraisamy
Or better use this. my $subject_line = substr( $line, 43, 7 ); %main = ( To => '[EMAIL PROTECTED]', From=> '[EMAIL PROTECTED]', Subject => "$subject_line", Message => 'whatever' ); ... [Sathish] -Original Message-

RE: Output to email

2001-12-28 Thread SathishDuraisamy
The value for the hash-key 'Subject' should be a scalar such as a number or string. It shouldn't be a 'print' statement. Just use the substr() which returns a string. %mail = ( To => '[EMAIL PROTECTED]', From=> '[EMAIL PROTECTED]', Subject => substr($line

Thank's everybodyRE: count the number of characters

2001-12-28 Thread Mark Mclogan
> >if ( length($variable) < 8 ) { > # > # less than 8 characters, put what you want here > # > } > >-Original Message- >From: Mark Mclogan [mailto:[EMAIL PROTECTED]] >Sent: Friday, December 28, 2001 10:31 >To: [EMAIL PROTECTED] >Subject: count the number of char

Re: Output to email

2001-12-28 Thread KeN ClarK
you have the option of searching via nntp or the web-based list for old messages at http://nntp.perl.org/group/perl.beginners/ of course, that's how i spend my time, since i'm very NEW, and hence don't know the answer to your ?... k On Fri, 28 Dec 2001, Lance Prais wrote: > > I am sorry I a

RE: Question for those familiar with imagemagick for perl

2001-12-28 Thread Hanson, Robert
This works for me at the command line... use strict; use CGI; use CGI::Carp qw/fatalsToBrowser/; use Image::Magick; my $q = Image::Magick->new; $q->Set(size=>'30x105'); $q->Read('gradient:#00f685-#0083f8'); $q->Rotate(-90); $q->Raise('6x6'); $q->Annotate(text=>'Push Me',font=>'@/Fonts/LucidaBrigh

Output to email

2001-12-28 Thread Lance Prais
I am sorry I asked this question a while back but my computer crashed and lost all my documentation. I am trying to output text from a doc. that I am reading to an email I am sending but it is not working. Here is my code: print STDERR "\nline: ", substr($line, 43, 7); ---This outputs th

Re: Question for those familiar with imagemagick for perl

2001-12-28 Thread Joelmon2001
In a message dated 12/28/01 2:10:56 PM Eastern Standard Time, [EMAIL PROTECTED] writes: > my $q=Image::Magick->new; Hello and thanks for your time. Now I get an internal server error (The default internal error) What's weird is I have another script that uses image magick, t hough the image

Re: Question for those familiar with imagemagick for perl

2001-12-28 Thread Paul Johnson
On Fri, Dec 28, 2001 at 01:59:38PM -0500, [EMAIL PROTECTED] wrote: > Hello, I asked this question to their list, but nobody had an answer, and the > help isn't reliable, so I hope I can ask. It is about a perl script, which > comes with it. button.pl > > It gives a software error: > Software er

Question for those familiar with imagemagick for perl

2001-12-28 Thread Joelmon2001
Hello, I asked this question to their list, but nobody had an answer, and the help isn't reliable, so I hope I can ask. It is about a perl script, which comes with it. button.pl It gives a software error: Software error: Execution of /home/sites/site30/web/button.pl aborted due to compilation

RE: count the number of characters

2001-12-28 Thread Wagner-David
if ( length($variable) < 8 ) { # # less than 8 characters, put what you want here # } Wags ;) -Original Message- From: Mark Mclogan [mailto:[EMAIL PROTECTED]] Sent: Friday, December 28, 2001 10:31 To: [EMAIL PROTECTED] Subject: count the number of characters

Re: count the number of characters

2001-12-28 Thread Agustin Rivera
$count=length($var); Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com - Original Message - From: "Mark Mclogan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 28, 2001 10:31 AM Subject: count the number of characters > Hi! question. > I get a v

RE: Automatic execute of script

2001-12-28 Thread Chris Spurgeon
You can sometimes get at it from the client side...if you can set up something on a machine that you control to periodically request a webpage from the server, and if that web page runs the perl script you want to fire, you can accomplish the same thing that way. Chris Spurge

count the number of characters

2001-12-28 Thread Mark Mclogan
Hi! question. I get a variable of a web form but I need that this variable has like minimum 8 characters as I can count the number of characters of a variable? Thank's Over Mark Mclogan _ Chat with friends online, try MSN Me

Re: Pipes

2001-12-28 Thread Paul Johnson
On Fri, Dec 28, 2001 at 11:21:04AM -0800, Mariana Añez wrote: > > Hi > How can i do a pipe program with perl? > I mean I want to make a program it can be used like this: > > ls | myprogram | ps Just take your input from STDIN and send your output to STDOUT, although in general you won't n

RE: searching a sub string

2001-12-28 Thread Hanson, Robert
I see one problem, and have two comments... Why do this... $_=; my $line=$_; When you can just do this... my $line = ; This can be simplifed... for(my $i=0; $i<22; $i++){} Try this... for(1..22){} The problem I see is that you are reading from EMAIL, but you opened a filehandle nam

Re: Automatic execute of script

2001-12-28 Thread Tom Bartos
the AT command works a lot like cron, see if you can use the AT command - Original Message - From: "jeff" <[EMAIL PROTECTED]> To: "Beginners" <[EMAIL PROTECTED]> Sent: Friday, December 28, 2001 9:37 AM Subject: RE: Automatic execute of script > Our business hosting service does not allo

RE: Automatic execute of script

2001-12-28 Thread Jeff Liu
I do not know other ways. probably you can try, while (<>) { sleep x; your script task; } This will let your script keep running and never exit, you can change "x" value to setup the frequency as your wish. Jeff Liu -Original Message- From: jeff [mailto:[EMAIL PROTECTED]] Sent:

RE: Automatic execute of script

2001-12-28 Thread Maciejewski, Thomas
can you afford autosys? you can also just right a process that loops and checks the time then runs things as needed but that is a hacks since it is what cron does autosys is a real nice tool but is quite expensive -Original Message- From: jeff [mailto:[EMAIL PROTECTED]] Sent: Friday

RE: Automatic execute of script

2001-12-28 Thread jeff
Our business hosting service does not allow cron, they recommend checking with a third party. I write the scripts on a windows machine and upload them to the apache Unix server to test and execute them. Do you know of any perl modules that self execute? -Original Message- From: Jeff Liu

child processes and environment variables

2001-12-28 Thread Maciejewski, Thomas
I am having an issue when spawning a child it appears that the environment variable is not being passed to the child process here is the code: my $kidpid = open($fh, "-|"); if (! $kidpid) { open(STDERR, "> /dev/null"); # rlog may complain; ignore.

child processes and environment variables

2001-12-28 Thread Maciejewski, Thomas
I am having an issue when spawning a child it appears that the environment variable is not being passed to the child process here is the code: my $kidpid = open($fh, "-|"); if (! $kidpid) { open(STDERR, "> /dev/null"); # rlog may complain; ignore.

RE: searching a sub string

2001-12-28 Thread Lance Prais
Here is my code #open a file with the filehandle open EMAILAGENT, "+<..\\..\\emailagent.txt" or die "Cannot open email agent $!\n"; for(my $i=0; $i<22; $i++){}; #This will put you at row 23. $_=; my $line=$_; print STDERR "\nline: ", substr($line, 44, 7); #should print a vlue

RE: pattern match

2001-12-28 Thread Hanson, Robert
It will match the same text, but it will not grab the same data into $1, $2, and $3. The first one will assign each of these vars while the second will only assign $1 with the last (\s+\d+). Rob -Original Message- From: Srinivas Reddy [mailto:[EMAIL PROTECTED]] Sent: Friday, December 2

RE: Automatic execute of script

2001-12-28 Thread Jeff Liu
If you are using Unix, add your script in /etc/crontab like this. 0 3 * * * root /usr/local/bin/your-script 0 means run at minute 0. 3 means run at 3:00a.m. * means every day Jeff Liu -Original Message- From: jeff [mailto:[EMAIL PROTECTED]] Sent: December 28, 2001 11:41 AM To: Beginn

RE: Automatic execute of script

2001-12-28 Thread David . Neal
On unix you wanna look at cron man crontab on NT you could use 'at' I think ... D > -Original Message- > From: webmaster > Sent: 28 December 2001 16:41 > To: beginners > Cc: webmaster > Subject: Automatic execute of script > > > Does anyone know how to get a script to execute at

Automatic execute of script

2001-12-28 Thread jeff
Does anyone know how to get a script to execute at a predefined time without user interaction. I would like to monitor my sys clock and have the perl script execute. Thanks Jeff -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

pattern match

2001-12-28 Thread Srinivas Reddy
Hi Here i have two pattern match statements can some one tell me whether the two are same or not. match_pattern = {",\s*",fld,"(\s+\d+)(\s+\d+)(\s+\d+)\s*,"}; changed to the following match_pattern = {",\s*",fld,"(\s+\d+){3}\s*,"}; is it same or different i think they are not same... thanks

RE: Newbie question...

2001-12-28 Thread Hanson, Robert
What happens first is that the whole script is compiled, subroutines and all. After that, yes, it starts at the top. Because the subroutines have already been compiled you can use them any place in the script (in some languages you need to have the subroutines higher in the script than where th

Newbie question...

2001-12-28 Thread Richard.C.1
I'm just starting to learn PERL and loving it. I am looking at some scripts to see how they're written, and I had a question about script "flow". The script I'm looking at has a lot of subroutines in it. Am I correct in assuming that when a PERL CGI script runs, execution starts at the beginnin

RE: Help, I am new to Perl

2001-12-28 Thread Hanson, Robert
You didn't mention where the data is located, so I can only speculate. I listed the perldoc command's below to get more info on each of the functions... If the data is in a file you need to read the file, see "perldoc -f open" for info on that. If the file is in a comma seperated file (or any

RE: Pipes

2001-12-28 Thread Hanson, Robert
You can read the input from the STDIN filehandle. [Perl script] #!/usr/bin/perl my $linecount = 0; while ( my $line = ) { $linecount++; print "Line $linecount: $line"; } [At the command line...] # this cats the file, and the script adds numbers # to each line before printing them out. ca

Help, I am new to Perl

2001-12-28 Thread Anna Grace Zapata
Good morning everyone, I am trying to create a report that will allow me to get a total number of modem sessions, total connect time to the modems, average connect time per session, average number of sessions per user, and the average connect time per user. I know where all my data is located.

Pipes

2001-12-28 Thread Mariana Añez
Hi How can i do a pipe program with perl? I mean I want to make a program it can be used like this: > ls | myprogram | ps Is using “open” the only way? Thanks in advance and HAPPY HOLIDAYS Mariana C. Añez Salaverria --- Sync Consultores c.a. www.syn

RE: :FTP

2001-12-28 Thread Hanson, Robert
I'm not sure how much you understand about Net::FTP, and there wasn't a code sample, so I can only give a general idea of what I would do. my @sites = ('ftp.site1.com', 'ftp.site2.com'); foreach my $site ( @sites ) { doFtpStuff($site) and last; } You would need to write the doFtpStuff s

Re: trimming multiline strings

2001-12-28 Thread John W. Krahn
Adriano Rodrigues Ferreira wrote: > > My problem is: > > Given a (multiline) string, I want a function which remove all leading and trailing > white-space (as given by \s). > > Examples: > " abbds \n sass " => "abbds \n sass" > "a "

trimming multiline strings

2001-12-28 Thread Adriano Rodrigues Ferreira
My problem is: Given a (multiline) string, I want a function which remove all leading and trailing white-space (as given by \s). Examples: " abbds \n sass " => "abbds \n sass" "a " => "a" " \n first phrase \n second ph

Re: Hello. How can I fix this line of code?

2001-12-28 Thread Andrea Holstein
[EMAIL PROTECTED] wrote: > Hi, there. I am a perl newbie. I just was curious how I can convert this: > $q -> start_form({action => $q -> url()}) . > > (Where url = www.domain.com) > > to turn url into > www.domain.com/form.htm > > I don't know how to edit that line to do it > > Just figured I'd

Re: Hash question

2001-12-28 Thread Andrea Holstein
Wim De Hul wrote: > > Hashes are hard to understand (regarding on the questions in this > list...). I have also a question: > Why doesn't this work? I get a synthax error? > > foreach $index (sort keys %IfType{$router}) { > print " Interface: $IfType{$router}{$index

Hash question

2001-12-28 Thread Wim De Hul
Hello people, Hashes are hard to understand (regarding on the questions in this list...). I have also a question: Why doesn't this work? I get a synthax error? foreach $index (sort keys %IfType{$router}) { print " Interface: $IfType{$router}{$index}\n";