Re: Please explain forking

2002-06-20 Thread Sudarsan Raghavan
Langa Kentane wrote: > Greetings, > I wish to use the fork() function on one of my scripts. I would like more > clarity on the way it works. > > Take for instance the ff code: > > Sub mysub > { > while () > If ($_ eq "SCANME") > { > fork() After the fork c

Fwd: Re: Please explain forking

2002-06-20 Thread Marco Antonio Valenzuela Escárcega
On Thu, 2002-06-20 at 23:30, Langa Kentane wrote: > Greetings, > I wish to use the fork() function on one of my scripts. I would like more > clarity on the way it works. > > Take for instance the ff code: > > Sub mysub > { > while () > If ($_ eq "SCANME") > { > fo

Re: Formatting

2002-06-20 Thread Marco Antonio Valenzuela Escárcega
On Thu, 2002-06-20 at 22:42, Shishir K. Singh wrote: > Hi, hi > > I need to format a string in a fixed width field. The string may be less than the >length of the format, or may be greater. If less, then it should get padded with >spaces (left or right justified , like using - in sprintf), if

Re: perl prob?

2002-06-20 Thread David T-G
Javeed -- Is there a particular reason you sent your note to Shishir directly? I've removed him from the Cc: line in case that matters... ...and then Javeed SAR said... % % Hi, Hello! % % I am a begginer in perl? % i have a doubt. Welcome :-) % % when i create a file it should not hav

Please explain forking

2002-06-20 Thread Langa Kentane
Greetings, I wish to use the fork() function on one of my scripts. I would like more clarity on the way it works. Take for instance the ff code: Sub mysub { while () If ($_ eq "SCANME") { fork() system("nessus" "thathost");

perl prob?

2002-06-20 Thread Javeed SAR
Hi, I am a begginer in perl? i have a doubt. when i create a file it should not have space bar in it's file name; eg help file if it is there it should not create the file, it should throw a error message "space in file name not allowed" can u help me in this. regards javeed

RE: Formatting

2002-06-20 Thread Timothy Johnson
Try testing for the length of the string and then using the substr() function to get the part that you want for strings that are longer than desired. -Original Message- From: Shishir K. Singh To: [EMAIL PROTECTED] Sent: 6/20/02 10:42 PM Subject: Formatting Hi, I need to format a stri

RE: Formatting

2002-06-20 Thread David . Wagner
You can build the format string: my $myVar = 'ABCD'; #(Left Aligned, padded with spaces) #$newVar = sprintf("%-10s,$myVar); #$newVar should have 'ABCD '; # Works while ( 1 ) { printf "eft or ight: "; chomp(my $MyInput = ); last if ( $MyInput =~ /^ex/i ); my $MySign = '-'

Formatting

2002-06-20 Thread Shishir K. Singh
Hi, I need to format a string in a fixed width field. The string may be less than the length of the format, or may be greater. If less, then it should get padded with spaces (left or right justified , like using - in sprintf), if greater, then the string should get truncated to the exact len

Re: Sending attachments with Sendmail

2002-06-20 Thread Steven Maroney
browse through www.cpan.org for some modules. I once used a module that allowed to send mime encoded emails along with attachments. I cant remember the module name. On Thu, 20 Jun 2002, Troy May wrote: > Hello, > > I need to know if I can send an attachment along with an email. I'm using > S

Re: homemade virus scanner, is this a good method?

2002-06-20 Thread John W. Krahn
Zentara wrote: > > Hi, Hello, > I'm starting work on my own virus scanner. > > I tried File::Scan and was getting some sort of error, so > please don't tell me to use it. > > I started looking into the virus signature list at > openvirus.org, it looks something like this. > > . > VCS

Re: cat binary file

2002-06-20 Thread Todd Wade
Gary Stainburn wrote: > On Thursday 20 June 2002 3:56 pm, Gary Stainburn wrote: > > open(FIN,"<$fname.pdf") || &dodie("cannot access PDF: $!\n"; > print "Content-Type: text/html\n\n"; > while (sysread FIN, $buffer, 4096) { > print $buffer); > } > close FIN; > This is how to do it. Todd W.

homemade virus scanner, is this a good method?

2002-06-20 Thread zentara
Hi, I'm starting work on my own virus scanner. I tried File::Scan and was getting some sort of error, so please don't tell me to use it. I started looking into the virus signature list at openvirus.org, it looks something like this. . VCS=b90f0489feac32c4aae2 Just a list of

RE: filter list of files from directory into array

2002-06-20 Thread David . Wagner
The mailer was implying that you have my $dir = 'c:\xxx\xxx'; where this has your directory location Wags ;) -Original Message- From: Auernheimer, Rebecca (CORP, Consultant) [mailto:[EMAIL PROTECTED]] Sent: Thursday, June

RE: filter list of files from directory into array

2002-06-20 Thread Auernheimer, Rebecca (CORP, Consultant)
When I tried: my @filelist = grep { -f "$dir/$_" && m/^\d{5,6}$/} readdir DIR; I got this message: Global symbol "$dir" requires explicit package name at C:\perl\practice\test.pl line 5. Execution of C:\perl\practice\test.pl aborted due to compilation errors. I was going to ask about $dir

Re: filter list of files from directory into array

2002-06-20 Thread drieux
On Thursday, June 20, 2002, at 03:03 , Auernheimer, Rebecca (CORP, Consultant) wrote: [..] > my @filelist = grep { $_ ne -d && m/^\d\d\d(\d|\d\d)\d$/ }, readdir DIR; > another close but no cigar you might try my @filelist = grep { /^\d{5,6}$/ && -f "$baseDir/$_" } readdir DIR ; The basic illu

Re: Help, Help....! Syntax and logic problem.

2002-06-20 Thread John W. Krahn
Naser Ali wrote: > > Hello Every one, Hello, > I have attached the samples of the text files from which I am trying to > search and compare certain pattern along with the code. I f you look at the > text file, you will see that from the first sample, there is time value on > line number 2,3,8,

RE: filter list of files from directory into array

2002-06-20 Thread Felix Geerinckx
on Thu, 20 Jun 2002 22:29:45 GMT, David Wagner wrote: > But unless you have done a chdir it will only pass the file name or > directory name and not do what you want. You are absolutely right. The line should read: my @filelist = grep { -f "$dir/$_" && m/^\d{5,6}$/} readdir DIR; whe

RE: filter list of files from directory into array

2002-06-20 Thread David . Wagner
But unless you have done a chdir it will only pass the file name or directory name and not do what you want. Wags ;) -Original Message- From: Felix Geerinckx [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 20, 2002 15:31 To: [EMAIL PROTECTED] Subject: Re: filter list of files fro

Re: filter list of files from directory into array

2002-06-20 Thread Felix Geerinckx
on Thu, 20 Jun 2002 22:03:04 GMT, wrote: > So far, I am just trying to read a directory > of files into an array, but only those files that are named with 5 or > 6 numbers and no extension, like 12345 or 654321. I've got that part > down except that I don't know how to keep another directory ou

RE: filter list of files from directory into array

2002-06-20 Thread David . Wagner
Could add the: grep m/^\d\d\d(\d|\d\d)\d$/ && ! -e "c:\\prod\\rej" . $_ , readdir DIR; You need to have the directory location because the readdir returns only the file or directory name read. Wags ;) ps Did test and put out files only. -Original Message- From: Auernhei

filter list of files from directory into array

2002-06-20 Thread Auernheimer, Rebecca (CORP, Consultant)
Hello List, I am working on my first "real" Perl program. I am using Active Perl 5.6 on Windows NT/2000. So far, I am just trying to read a directory of files into an array, but only those files that are named with 5 or 6 numbers and no extension, like 12345 or 654321. I've got that part down

Re: using Net::SMTP

2002-06-20 Thread drieux
On Thursday, June 20, 2002, at 02:02 , Nate Brunson wrote: > is there a way I can get Net::SMTP to return errors that it might > encounter into a variable, or something? > so that on the page that pops up after the mail is sent, it can display > errors if there were any. I have read the man p

Re: Any Site can recommand to me ?

2002-06-20 Thread Connie Chan
"passed" ? :- ) Thanks a lot ! You 've reminded me a question that I ever wanna ask but ever forget to ask... Is that any Certificate Exam for qualify on the standard of Perl ? Smiley Connie =) - Original Message - From: "Felix Geerinckx" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> S

Re: Any Site can recommand to me ?

2002-06-20 Thread drieux
On Thursday, June 20, 2002, at 01:45 , Connie Chan wrote: > > 1. A list of full pure perl syntax, with usage description and example. > 2. Like Javascript.com does ( A short sample code for a certain purpose. > ) > 3. Perldoc in Chinese =) My general Stack of things about Perl Documentation is

Re: Any Site can recommand to me ?

2002-06-20 Thread Felix Geerinckx
on Thu, 20 Jun 2002 20:45:09 GMT, Connie Chan wrote: > I am going to find some sites for further study Perl... I just found > that I still in the kid level as a Perl programmer... So, would > anybody give me some suggestion on the site for : > > 1. A list of full pure perl syntax, with usage de

Re: Would it be simpler ?

2002-06-20 Thread Jeff 'japhy' Pinyan
On Jun 21, Connie Chan said: >Why CGI.pm ? What difference ? =) Because CGI does it right. It's easy to do it wrong. Very wrong, very easily. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.

Re: Would it be simpler ?

2002-06-20 Thread Felix Geerinckx
on Thu, 20 Jun 2002 20:37:32 GMT, Connie Chan wrote: > Why CGI.pm ? What difference ? =) Because it already contains all logic to parse *all* standards conforming query-strings, not only your special case. Soon you may want to work with an html-form instead of appending the query string to a U

Any Site can recommand to me ?

2002-06-20 Thread Connie Chan
Hi all, I am going to find some sites for further study Perl... I just found that I still in the kid level as a Perl programmer... So, would anybody give me some suggestion on the site for : 1. A list of full pure perl syntax, with usage description and example. 2. Like Javascript.com does ( A

Re: Would it be simpler ?

2002-06-20 Thread Connie Chan
Why CGI.pm ? What difference ? =) - Original Message - From: "Felix Geerinckx" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, June 21, 2002 1:54 AM Subject: Re: Would it be simpler ? > on Thu, 20 Jun 2002 17:27:35 GMT, Connie Chan wrote: > > > Hi all, I am now making a bo

Re: Would it be simpler ?

2002-06-20 Thread Connie Chan
Thanks a lot Japhy, that's exactly the key I want =) Assign the value at first, replace it when match... That's very great !!! Smiley Connie =) > > sub getQuery { > my %ret = ( > user => 'system', > book => 'index', > page => 0, > ); > > my $query = shift or ret

Re: Perl X ASP

2002-06-20 Thread Todd Wade
Joao Silva wrote: > >Why should use CGI with Perl instead of ASP??? > This is sort of like asking why should I eat an apple instead of an orange. Maybe you dont have an apple, maybe you dont like apples, or maybe you dont mind apples too much, its just that you are a little more farmilia

Re: Effective Bad Coding Habits

2002-06-20 Thread drieux
On Thursday, June 20, 2002, at 09:01 , Jeff 'japhy' Pinyan wrote: > [NOTE: this is a reply to a SATIRE, so don't wig out] You should have warned me that there was a clear defect in the _info model but I have fixed the document and have demonstration code up http://www.wetware.com/drieux/pbl/bl

Re: variable scope question

2002-06-20 Thread Felix Geerinckx
on Thu, 20 Jun 2002 12:41:34 GMT, Martin A. Hansen wrote: > i will elaborate the question: > > > i have a huge script with many global variables and subroutines. > > several variable names are reused, but lexically scoped to > subroutines and everything works fine. > > but if you forget (bug

Re: Effective Bad Coding Habits

2002-06-20 Thread Ovid
--- drieux <[EMAIL PROTECTED]> wrote: > hence > $globals{var1} - scalar variable > $globals{var1_a}- array variable > $globals{var1_h}- hash variable > $globals{var1_s}- sub variable > $globals{var1_ar} - reference to an array va

Re: error using perldoc

2002-06-20 Thread drieux
On Thursday, June 20, 2002, at 10:55 , Joe Echavarria wrote: > Hi there, > > I have alredady installed Perl for Solaris 2.6 and > when i try to use the "perldoc" help i get this error: > > root>perldoc -f print > Superuser must not run /usr/local/bin/perldoc without > security audit and taint

Re: error using perldoc

2002-06-20 Thread Felix Geerinckx
on Thu, 20 Jun 2002 17:55:00 GMT, Joe Echavarria wrote: > I have alredady installed Perl for Solaris 2.6 and > when i try to use the "perldoc" help i get this error: > >root>perldoc -f print > Superuser must not run /usr/local/bin/perldoc without > security audit and taint checks. > > Ho

Re: getopt that handles more arguments per option

2002-06-20 Thread drieux
On Wednesday, June 19, 2002, at 09:57 , Timothy Johnson wrote: [..] > But just for > the sake of argument, here's one approach: On a more serious note, you cats may want to try perldoc -m Getopt::Std and walk through what is in the code - since it has a really nice structure of the for

Re: Would it be simpler ?

2002-06-20 Thread Jeff 'japhy' Pinyan
On Jun 21, Connie Chan said: >sub getQuery { > my $queryStr = @_; my %ret; You mean: my ($queryStr) = @_; or my $queryStr = shift; or my $queryStr = $_[0]; > if (! $queryStr) { $ret{user} = 'system' ; $ret{book} = 'index' ; $ret{page} = >0 } > else { >( $ret{user}, $ret

error using perldoc

2002-06-20 Thread Joe Echavarria
Hi there, I have alredady installed Perl for Solaris 2.6 and when i try to use the "perldoc" help i get this error: root>perldoc -f print Superuser must not run /usr/local/bin/perldoc without security audit and taint checks. How can i fix it ?, what i need to do? Thanks, Joe Echav

Re: Would it be simpler ?

2002-06-20 Thread Felix Geerinckx
on Thu, 20 Jun 2002 17:27:35 GMT, Connie Chan wrote: > Hi all, I am now making a bookshelf program with perl. > At this very beginning, I do wonder if the below script > can be simpler or not... > > [code snipped] Please don't do this: use CGI.pm instead: #! perl -w use strict;

Re: daemon code

2002-06-20 Thread Peter Scott
At 09:01 AM 6/20/02 +0200, Damir Horvat wrote: >Hi! > >I've been trying to keep this thingie going with this sub, but it dies on >me every now and then ... > >or, does someone have a full-featured daemon code|sub? % perldoc -q daemon Found in /opt/perl/lib/5.6.1/pod/perlfaq8.pod How do I fo

Re: variable scope question

2002-06-20 Thread Peter Scott
At 02:41 PM 6/20/02 +0200, Martin A. Hansen wrote: >i will elaborate the question: > > >i have a huge script with many global variables and subroutines. > >several variable names are reused, but lexically scoped to subroutines >and everything works fine. > >but if you forget (bugs do occur!) to d

Would it be simpler ?

2002-06-20 Thread Connie Chan
Hi all, I am now making a bookshelf program with perl. At this very beginning, I do wonder if the below script can be simpler or not... sub getQuery {my $queryStr = @_; my %ret; if (! $queryStr) { $ret{user} = 'system' ; $ret{book} = 'index' ; $ret{page} = 0 } else

Sorting an array based on the values in a hash

2002-06-20 Thread Kevin Old
Hello all, I have a hash with the key being the field name and the value being the order in which the field is to be displayed.like below: %order = ( DATE => '1', CPP => '2', ESN => '3', BTS => '4' ); I'm receiving an array that would look somethi

Re: Sorting an array based on hash values

2002-06-20 Thread Jeff 'japhy' Pinyan
On Jun 20, Kevin Old said: >I have a hash with the key being the field name and the value being the >order in which the field is to be displayed.like below: > >%order = ( > DATE => '1', > CPP => '2', > ESN => '3', > BTS => '4' > ); > >I'm receiving an array t

Sorting an array based on hash values

2002-06-20 Thread Kevin Old
Hello all, I have a hash with the key being the field name and the value being the order in which the field is to be displayed.like below: %order = ( DATE => '1', CPP => '2', ESN => '3', BTS => '4' ); I'm receiving an array that would look somethi

RE: getopt that handles more arguments per option

2002-06-20 Thread Timothy Johnson
The "GetMultiOpts(\@eArray)" passes a reference to an array to the GetMultiOpts sub so that it knows which array to put the arguments in. Once it is invoked, it puts any arguments it finds into the array passed to it until it hits another switch, then it passes control back to the first loop. W

Re: Uploading sound and image files

2002-06-20 Thread zentara
On Wed, 19 Jun 2002 17:37:44 +0200 (MESZ), [EMAIL PROTECTED] wrote: >Hello! > >I still have problems with my script.I can't really figure out what's >wrong with it. 1 thing for sure, if you "use CGI"; you don't need the old ReadParse routine. if ($ENV{'REQUEST_METHOD'} eq 'POST') {

RE: rand < vs rand >

2002-06-20 Thread Jeff 'japhy' Pinyan
On Jun 20, Balint, Jess said: >Are these -l and -n flags specific to perl 5.6? I am using 5.005 and they >don't work as illustrated: The -l and -n flags have been with Perl for quite some time. >% perl -e 'while{print if(.45909592993094279021 < rand);}' db_mlb_undup.dat Uh, you're missing some

Re: getopt that handles more arguments per option

2002-06-20 Thread Harry Putnam
Timothy Johnson <[EMAIL PROTECTED]> writes: > sub GetMultiOps{ > $ref = $_[0]; > while($ARGV[0] !~ /^-\w$/){ > $_ = shift @ARGV; > push @{$ref},$_; > } > } > > ### END # > > Which should theoretically give you one array for each option and one array > as a cat

Re: Effective Bad Coding Habits

2002-06-20 Thread drieux
On Thursday, June 20, 2002, at 09:01 , Jeff 'japhy' Pinyan wrote: > [NOTE: this is a reply to a SATIRE, so don't wig out] what? you mean it's not a good basis for a 4/1 RFC standard??? > On Jun 20, drieux said: > >> my %globals; # where we hide all our globals >> #

RE: cat binary file

2002-06-20 Thread Bob Showalter
> -Original Message- > From: Gary Stainburn [mailto:[EMAIL PROTECTED]] > Sent: Thursday, June 20, 2002 12:11 PM > To: Bob Showalter; [EMAIL PROTECTED] > Subject: Re: cat binary file > > ... > The point was that I was doing this at the end of a quite > long perl script, > and wanted to d

Re: Effective Bad Coding Habits

2002-06-20 Thread Felix Geerinckx
on Thu, 20 Jun 2002 15:15:32 GMT, Drieux wrote: > It just struck me that there are many ways to > make bad coding habits more effective. > > Folks EITHER need to get out of the habit of > using a bunch of globals - or become more > effective at the process. > > To this latter end I offer this s

Re: cat binary file

2002-06-20 Thread Gary Stainburn
Hi Bob, On Thursday 20 June 2002 4:38 pm, Bob Showalter wrote: > > -Original Message- > > From: Gary Stainburn [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, June 20, 2002 10:57 AM > > To: [EMAIL PROTECTED] > > Subject: cat binary file > > > > > > Hi all, > > > > I know this is a FAQ, but

RE: rand < vs rand >

2002-06-20 Thread Balint, Jess
Are these -l and -n flags specific to perl 5.6? I am using 5.005 and they don't work as illustrated: % perl -e 'while{print if(.45909592993094279021 < rand);}' db_mlb_undup.dat syntax error at -e line 1, near "while{" Execution of -e aborted due to compilation errors. % cat db_mlb_undup.dat | per

Perl X ASP

2002-06-20 Thread joao silva
Why should use CGI with Perl instead of ASP??? JP, from Brazil _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe, e-mail: [EMAIL PRO

Re: cat binary file

2002-06-20 Thread Gary Stainburn
On Thursday 20 June 2002 4:34 pm, David T-G wrote: > Gary -- > > ...and then Gary Stainburn said... > % > % On Thursday 20 June 2002 3:56 pm, Gary Stainburn wrote: > % > > ... > % > What's the best way to cat a binary (file with non-display chars) to > % > STDOUT? > ... > % open(FIN,"<$fname.pdf")