taint match

2001-11-28 Thread Francesco Scaglioni

Hi,

The following line returns a value of 1 (one) - presumably to confirm
a match.  What am I missing such that $subject contains the value of
the param ( if matches ).

( my $subject  ) = ( param( 'subject'  ) =~  /^(\w+)$/i )  || '';

TIA

Francesco

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: taint match

2001-11-28 Thread Bob Showalter

 -Original Message-
 From: Francesco Scaglioni [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 28, 2001 10:30 AM
 To: [EMAIL PROTECTED]
 Subject: taint match
 
 
 Hi,
 
 The following line returns a value of 1 (one) - presumably to confirm
 a match.  What am I missing such that $subject contains the value of
 the param ( if matches ).
 
 ( my $subject  ) = ( param( 'subject'  ) =~  /^(\w+)$/i )  || '';

The || expression is forcing the m// into scalar context. Just leave it
off; if there is no match, $subject will be set to undef.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Redirecting STDOUT to a variable...

2001-11-28 Thread Brett W. McCoy

On Wed, 28 Nov 2001 [EMAIL PROTECTED] wrote:

 I am looking to run a command using perl and get its return value as well as
 its STDOUT. Currently I am doing is

 $result = system($myCommand out.txt);
 open(FILE, out.txt);

 and then processing the data from the file. This is terribly slow for my
 application. Is there some way where I can redirect the output directly to a
 variable and not have to do the file thing.

Certainly.  Use the backtick operator to slurp all of the output at once,
use a scalar to store it all in one string, or put it into list context
and dump each line into an array.

my $result = `$myCommand`;
my @result = `$myCommand`;

If you think the output is going to be big, or you want to process each
line of output as it occurs, you can do this:

open CMD, $myCommand | or die couldn't fork: $!\n;

while(CMD) {

do something if /some pattern to match/;
}

close CMD;

-- Brett
  http://www.chapelperilous.net/

The finest eloquence is that which gets things done.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Redirecting STDOUT to a variable...

2001-11-28 Thread Ajmera_Mayank

Hi
Thanks, but I need to preserve the value returned by $mycommand also. I
guess using backticks won't allow me to do that .
Mostly what I need to do is read from STDOUT into a variable. But I don't
know how to do that.
Mayank

-Original Message-
From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 28, 2001 11:56 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Redirecting STDOUT to a variable...


On Wed, 28 Nov 2001 [EMAIL PROTECTED] wrote:

 I am looking to run a command using perl and get its return value as well
as
 its STDOUT. Currently I am doing is

 $result = system($myCommand out.txt);
 open(FILE, out.txt);

 and then processing the data from the file. This is terribly slow for my
 application. Is there some way where I can redirect the output directly to
a
 variable and not have to do the file thing.

Certainly.  Use the backtick operator to slurp all of the output at once,
use a scalar to store it all in one string, or put it into list context
and dump each line into an array.

my $result = `$myCommand`;
my @result = `$myCommand`;

If you think the output is going to be big, or you want to process each
line of output as it occurs, you can do this:

open CMD, $myCommand | or die couldn't fork: $!\n;

while(CMD) {

do something if /some pattern to match/;
}

close CMD;

-- Brett
  http://www.chapelperilous.net/

The finest eloquence is that which gets things done.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




accessing yahoo mail through text mode/shell

2001-11-28 Thread zaka rias

i have a script like this :
==
$name='sciensez';
$pass='blu635';
$serv='mail.yahoo.com';
$subj='Subject: Daily loggin report';

use Mail::POP3Client;
$client = new Mail::POP3Client($name, $pass, $serv);
$thestate = $client-State;

if($thestate eq 'AUTHORIZATION')
{die bad user name or password\n}
elsif($thestate eq 'DEAD')
{die mail server unreachable or unavailable \n}
#find out how many messages there are

$nummsg = $client -count;
for($i =1;$i=$nummsg; $i +=1) {
$headers =$client-Head($i);
@headlist = split(/\n/, $headers);
foreach $line (@headlist) {
if($line =~ /^$subj/) {
#found the body and print
$body = $client-Body($i);
print $body \n;
}
}
}

$client-close;



and always get message network unreachable bla bla
bla,

i dont understand, is that because yahoo.mail.com is
only free mail server (is this script is only working
in mail.myisp.com ?)

friends..i really need to accessing yahoo.mail or hot
mail or free mail through text mode, any solutions ?



thank you very much



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Need some assistance, should be easy.

2001-11-28 Thread Brian

I am looking for a way, script or variables used, to determine from where 
someone is comming from.

IE, if they click on my site from a search engine, or if they just type in 
the URL direct.

Does anyone have the means to assist?

Thank You! :)

Brian.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Help needed on parameters

2001-11-28 Thread Purshottam Chandak

perl -ipe s/yak/bak/g `dir *.yak` is supposed to allow me to do a search
and replace on all the .yak files in the directory in which I am working.
It doesn't; I get all sorts of errors. I've tried modifications of said
string- I've tried pipes,

I've tried separating the command line parameters with individual dashes,
I've tried turning
the `dir *.yak` command into a bat file and calling it like:

perl -i -p -e s/yak/bak/g `dir.bat`


All to no avail. Does anyone understand these parameter things well enough
to help me?

Pc



_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: help needed on substitution regex

2001-11-28 Thread William R Ward

[EMAIL PROTECTED] (Jeff 'Japhy' Pinyan) writes:
 On Nov 28, Leon said:
 (Q2)How to do the following :-
If there are 2 spaces, I wish to convert it into 1 nbsp like
 this =nbsp
3 spaces into 2 nbsp like this = nbspnbsp
4 spaces into 3 nbsp like this = nbspnbspnbsp
 
 I would do something like this:
 
   s/ ( +)/'nbsp;' x length($1)/g;
 
 That matches a space and then one or more spaces and stores the one or
 more part in $1.  The length of $1 is 1 less than the number of spaces
 found.

You need a /e option to make that work...

--Bill.

-- 
William R Ward[EMAIL PROTECTED]  http://www.wards.net/~bill/
-
 If you're not part of the solution, you're part of the precipitate.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: help needed on filling the feedback form.

2001-11-28 Thread William R Ward

[EMAIL PROTECTED] (Madhura Ranade) writes:
 I am trying to display the details filled in the feedback form.
 I want to display it below the feedback form.
 The comments entered by the client should be displayed below the feedback
 form after the submit button is clicked.
 what will be the code for the same in Perl

One way to do this (there's always more than one way) is:

Have the feedback form be generated by your Perl CGI script.  When the
user fills out the form and clicks Submit, have the form call the
*same* CGI script.  But this time, since there's form data, the CGI
script will display the results after it displays the form.  (You
probably want to also save it in a file...)

--Bill.

-- 
William R Ward[EMAIL PROTECTED]  http://www.wards.net/~bill/
-
 If you're not part of the solution, you're part of the precipitate.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Split

2001-11-28 Thread Scott R. Godin

In article [EMAIL PROTECTED], [EMAIL PROTECTED] (John W. Krahn) 
wrote:

  my @line = split /:/;
  if ( (lc($line[0]) eq lc($usrname))  ($line[3] == 45) )
 ^^  ^^
 This won't work if a user name has upper case letters, for example I
 just created these two accounts:
 
 # cat /etc/passwd
 [snip]
 roger:x:5001:100:Roger 1 Test:/home/roger:/bin/bash
 Roger:x:5002:100:Roger 2 Test:/home/Roger:/bin/bash

mmm true.. I'd forgotten about that. 

You catch that, Daniel?

print pack H*, 4a75737420416e6f74686572204d61635065726c204861636b65722c0d;
-- 
Scott R. Godin| e-mail : [EMAIL PROTECTED]
Laughing Dragon Services  |web : http://www.webdragon.net/
It is not necessary to cc: me via e-mail unless you mean to speak off-group.
I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox. :-)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




OO Perl programming.

2001-11-28 Thread Terrence Chan

Hi,

I'm new to OO Perl and I wonder if it is possible to implement Sigleton
pattern in OO perl. And how it is implemented.

Any info/pointer is welcomed.

Thanks in advance.

Terrence


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Parameters

2001-11-28 Thread Martin Pfeffer

what kind of problem you hav ?

martin

On Tue, 27 Nov 2001 22:04:25 +0530, you wrote:

I'd like some help running single line programs from the command line with
the -e parameter. I keep having problems.

Thanks.

Pc



_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Cpan Modul creation

2001-11-28 Thread Martin Pfeffer

hi to all

Does anyone know where i can find a documentation to make my Modul
CPAN conform?
I mean with makefile and and testscript and so on.
I mean not perldoc makemaker.

Thanx
Martin

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Cpan Modul creation

2001-11-28 Thread marcus_holland-moritz

| Does anyone know where i can find a documentation to make my Modul
| CPAN conform?

http://www-106.ibm.com/developerworks/linux/library/l-make.html

-- Marcus

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Help needed on parameters

2001-11-28 Thread John W. Krahn

Purshottam Chandak wrote:
 
 perl -ipe s/yak/bak/g `dir *.yak` is supposed to allow me to do a search
 and replace on all the .yak files in the directory in which I am working.
 It doesn't; I get all sorts of errors. I've tried modifications of said
 string- I've tried pipes,
 
 I've tried separating the command line parameters with individual dashes,
 I've tried turning
 the `dir *.yak` command into a bat file and calling it like:
 
 perl -i -p -e s/yak/bak/g `dir.bat`
 
 All to no avail. Does anyone understand these parameter things well enough
 to help me?


It looks like you are trying to do this on Windows.

perl -pi -eBEGIN{@ARGV=*.yak};s/yak/bak/g

Not tested! (I don't do Windows :)


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:parent window in Perl TK

2001-11-28 Thread Jorge Goncalvez

Hi, I wonder if it is possible to create a new window(children) that could herit 
all variables of a parent window in Perl TK under Windows .
So how can we do?
Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




open read write

2001-11-28 Thread nafiseh saberi

hi all.
how r u ?
I wish all of you be fine and happy.

I want to ...
1- open an existing file
2- read the number that exist in it
3- add it with 10
4-write the result in file.
5- note: I want to earse the last number and write the result 
 instead of it.

I write some code ..but doesn't work.

open (SALARY,-c:/salary);
 read (SALARY,$salary,5)   
  $salary=$salary+10;  

   
   
   
  print SALARY $salary;

  close SALARY;  


would you help me to compelte it.
thx for annny help.
___

Nafiseh Saberi   




Re: Help needed on parameters

2001-11-28 Thread Jenda Krynicky

From:   John W. Krahn [EMAIL PROTECTED]
 Purshottam Chandak wrote:
  
  perl -ipe s/yak/bak/g `dir *.yak` is supposed to allow me to do a
  search and replace on all the .yak files in the directory in which I
  am working. It doesn't; I get all sorts of errors. I've tried
  modifications of said string- I've tried pipes,
  
  I've tried separating the command line parameters with individual
  dashes, I've tried turning the `dir *.yak` command into a bat file
  and calling it like:
  
  perl -i -p -e s/yak/bak/g `dir.bat`
  
  All to no avail. Does anyone understand these parameter things well
  enough to help me?
 
 
 It looks like you are trying to do this on Windows.
 
 perl -pi -eBEGIN{@ARGV=*.yak};s/yak/bak/g

Apropos if I run this on Unix, what do I get ?

perl -e 'print BEGIN\nparam=;print(join(\nparam=, 
@ARGV));print \nEND\n' `ls`

Do I get all the file names in $ARGV[0] or does it split the ls 
output?

Why I ask  I wrote a module that allows you to give Perl scripts 
the parameters under Windows (almost) like under Unix (support 
for single quotes, backticks, globing, etc. etc.).
http://Jenda.Krynicky.cz/#G

I don't have any Unix by hand so I'm not sure what's the expected 
behaviour in this case.

Thanks, Jenda


=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: open read write

2001-11-28 Thread Ahmed Moustafa Ibrahim Ahmed

Hi Nafiseh,

I think can't open a file for reading and writing at the same time. 
Anyway, the following should help:

#--
open (FILE, $file) || die Can't open $file: $!\n;
$value = FILE;
close (FILE);

$value += 10;

open (FILE, $file) || die Can't open $file: $!\n;
print FILE $value;
close FILE;
#--

I don't know if it can be done in less code or not.

Good luck,

Ahmed



Nafiseh Saberi wrote:

 hi all.
 how r u ?
 I wish all of you be fine and happy.
 
 I want to ...
 1- open an existing file
 2- read the number that exist in it
 3- add it with 10
 4-write the result in file.
 5- note: I want to earse the last number and write the result 
  instead of it.
 
 I write some code ..but doesn't work.
 
 open (SALARY,-c:/salary);
  read (SALARY,$salary,5) 
  
   $salary=$salary+10;
  
  
  
  
   print SALARY $salary;  
  
   close SALARY;  
 
 
 would you help me to compelte it.
 thx for annny help.
 ___
 
 Nafiseh Saberi   
 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




modules installed with default install on IRIX 6.x

2001-11-28 Thread maarten hilgenga

Hi all,

After installing Perl 5.005.03 from the CPAN port on a Silicon Graphics 
running IRIX 6.3 without any problems, I tried installing an openssl library. 
During this installation I found two errors:

can't locate module strict.pm 
can't locate Getopt/Long.pm

My questions:
Are these modules included with a standard installation?
How do I find/get these modules?

thanx,

Maarten Hilgenga

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: open read write

2001-11-28 Thread Hasanuddin Tamir

On Wed, 28 Nov 2001, Ahmed Moustafa Ibrahim Ahmed [EMAIL PROTECTED] wrote,

 Hi Nafiseh,
 
 I think can't open a file for reading and writing at the same time. 
 Anyway, the following should help:
 
 #--
 open (FILE, $file) || die Can't open $file: $!\n;
 $value = FILE;
 close (FILE);
 
 $value += 10;
 
 open (FILE, $file) || die Can't open $file: $!\n;
 print FILE $value;
 close FILE;
 #--
 
 I don't know if it can be done in less code or not.

Yes, and safer also.

perldoc -q lock
perldoc perlfaq5

I still don't get locking.  I just want to incre­
ment the number in the file.  How can I do this?


san
-- 
Trabas - http://www.trabas.com



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: open read write

2001-11-28 Thread Rob

This works for me.

use Fcntl qw(:flock);

open(NUM, + next.num) || die Can't get new number\n$!\n;
flock(NUM, LOCK_EX) || die Can't lock next.num\n$!\n;
my($serviceNum) = NUM;
seek(NUM, 0, 0) || die Can't rewind next.num\n$!\n;
my($outNum) = $serviceNum + 10;
print NUM $outNum;
close(NUM);

Rob

Good judgement comes from experience, and experience -
well, that comes from poor judgement.



On Wed, 28 Nov 2001, Nafiseh Saberi wrote:

 hi all.
 how r u ?
 I wish all of you be fine and happy.
 
 I want to ...
 1- open an existing file
 2- read the number that exist in it
 3- add it with 10
 4-write the result in file.
 5- note: I want to earse the last number and write the result 
  instead of it.
 
 I write some code ..but doesn't work.
 
 open (SALARY,-c:/salary);
  read (SALARY,$salary,5) 
  
   $salary=$salary+10;
  
  
  
  
   print SALARY $salary;  
  
   close SALARY;  
 
 
 would you help me to compelte it.
 thx for annny help.
 ___
 
 Nafiseh Saberi   
 
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: OO Perl programming.

2001-11-28 Thread Adam Turoff

On Wed, Nov 28, 2001 at 04:54:53PM +0800, Terrence Chan wrote:
 I'm new to OO Perl and I wonder if it is possible to implement Sigleton
 pattern in OO perl. And how it is implemented.
 
 Any info/pointer is welcomed.

Check out search.cpan.org for singleton.  You'll find this:

http://search.cpan.org/doc/ABW/Class-Singleton-1.03/Singleton.pm

DESCRIPTION

This is the Class::Singleton module. A Singleton describes
an object class that can have only one instance in any
system. An example of a Singleton might be a print spooler
or system registry. This module implements a Singleton
class from which other classes can be derived. By itself,
the Class::Singleton module does very little other than
manage the instantiation of a single object. In deriving
a class from Class::Singleton, your module will inherit
the Singleton instantiation method and can implement whatever
specific functionality is required.

For a description and discussion of the Singleton class,
see Design Patterns, Gamma et al, Addison-Wesley, 1995,
ISBN 0-201-63361-2.

Z.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Eliminate a line of a list

2001-11-28 Thread Juan Manuel Espinoza

Hi everybody!
I have a problem i don't know
how can I make to eliminate a line of a list in HTML? and later to erase the 
lines that it selects.
I am considering to select using them  checkbox , but i don't how can i do 
for erasing them. How can I can do?

Thaks for your help.

_
Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Sorting a Hash

2001-11-28 Thread Pellerin, Dale

I am very new to hashes (as well as Perl) and am having some difficulty with
a cgi script.  This script allows individuals to post announcements via a
form.  The form data is stored in a text file, sorted in descending order by
date, and printed to the html page.  However, the script is currently
sorting by the month and not by the year, thus creating a problem when news
items are posted from 2002. (01/01/02 news items are being printed below
12/01/01 news items)

Here is a sample of the text file that the data is stored in:

http://is-blah.com/corprate/pages/news/cafeteria_closed.htm ~ 10/24/01 ~
Cafeteria closed

Here is  a snippet of code from the cgi script that sorts the file:

# Hash to sort date
$from = tmc.dat;
my %h;  

open(FILE, $from) || die Can't open $from!\n;
while (FILE) {
   chomp;
   ($announcement,$date,$description) = split(/~/,$_);
   
   # if the date has already been seen, tack this entry on to the hash value
if( $h{$date} ){ 
$h{$date} .= |$announcement~$description;
}

# date hasn't been seen, so create a new hash entry
else
{
$h{$date} = $announcement~$description;
}
}

#sort the dates in desc. order
foreach $key (sort {$b cmp $a} keys %h)
{
   #do for each item for that date
@items = split '\|', $h{$key};
foreach $item (@items)
{
#split back out the values and print the table
my($announcement,$description) = split /~/,$item;
print table width=800tr;
print tdimg border=0 width=14 height=14 id='_x_i1027'
src='http://is-web/corprate/gifs/blueball.gif';
print ALIGN='left'span style='font-size:13.5pt'a
href=\$announcement\font color=blue$description/font/a(font
color=black $key)/font/td;
print /tr/tablebr;

I would appreciate any assistance in figuring out how to sort by year, then
by month.  

Thank you.

Dale



Re: Cpan Modul creation

2001-11-28 Thread Elaine -HFB- Ashton

[EMAIL PROTECTED] [[EMAIL PROTECTED]] quoth:
*| Does anyone know where i can find a documentation to make my Modul
*| CPAN conform?
*
*http://www-106.ibm.com/developerworks/linux/library/l-make.html

That is not for a beginner and I'm not sure many seasoned pros would even
be quite that masochistic :)

http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlnewmod.html

the perlnewmod pod is a nice intro for beginners and old farts who never
got it right to begin with.

In addition to h2xs there is ExtUtils::ModuleMaker
http://search.cpan.org/search?dist=ExtUtils-ModuleMaker

e.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: modules installed with default install on IRIX 6.x

2001-11-28 Thread Elaine -HFB- Ashton

maarten hilgenga [[EMAIL PROTECTED]] quoth:
*Hi all,
*
*After installing Perl 5.005.03 from the CPAN port on a Silicon Graphics 
*running IRIX 6.3 without any problems, I tried installing an openssl library. 
*During this installation I found two errors:
*
*can't locate module strict.pm 
*can't locate Getopt/Long.pm
*
*My questions:
*Are these modules included with a standard installation?
*How do I find/get these modules?

Yes, both are 'core' modules and if they didn't get installed that would
be a real problem. Did the system produce that '' with the error or did
you? Look in your @INC and if they are in fact installed then you should
look at the program that's using perl and have a look at what it is really
trying to use...I seem to vaguely remember IRIX still using perl4 as late
as 96/97. 

e.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




The below CGI script creates my dataform.html but when I open it theres no contents;ie Candidate: $candidate etc

2001-11-28 Thread AMORE,JUAN (HP-Roseville,ex1)

Hello Everyone,
Any hints on how to send data into this file dataform.html file to append
and update its contents..
I'm trying to write code to capture the values from a URL address line and
have them sent
to a file to be entered and appended for me to view later.
The below code is what I'm trying to debug,because I can't get these values
John,Technician  BSdegree
from the following URL string
candidate=Johnposition=Technicianeducation=BSdegree
to get added to the dataform.html file.
This script creates the file dataform.html file but no values are
contained...
Any ideas,

#!/usr/bin/perl -w

use strict;
sub url_decode { # capture the values from the URL command line
my $text = shift();
$text =~ tr/\+/ /; # substitute the + for spaces
$text =~ s/%([a-f0-9][a-f0-9])/chr( hex( $1 ) )/eg; # clean up URL
string

use CGI;

# set my paramenters
my $q = new CGI;
my $candidate = $q-param('candidate');
my $position = $q-param('position');
my $education = $q-param('education');

# send the values from my URL command line to the dataform.html to be added
and appended:

open(OUT,  dataform.html) or die Can't open file: $!;
print Candidate: $candidate\n;
print Position: $position\n;
print Education: $Education\n\n;
close OUT;



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




How many arguments can perl take?

2001-11-28 Thread KEVIN ZEMBOWER

I'm trying to find all the HTML documents in my website and change a
line in them from  a link to a different site to an absolute link on the
current server. The perl one-liner I wrote is (Jeez, am I proud of
this):
find -iname *.*htm* -o -iname *.stm|xargs egrep -l
centernet\.jhuccp\.org/cgi-bin/mail2friend|cgi\.jhuccp\.org/cgi-bin/mail2friend|xargs
perl -pi~ -es?http://.*\.jhuccp\.org(/cgi-bin/mail2friend)?\1?g;

It seems to run fine and changes many files, but when I go searching
for the string that was supposed to be changed, I keep finding more
file. Many were changed correctly, but some were not.

It strikes me that maybe perl can't take too many arguments at once.
There are options to the xarg command that allow no more than so many
arguments at a time to be passed. Is this what's wrong? What should I
set the number of arguments to?

Thanks for trying to help me with this.

-Kevin Zembower

-
E. Kevin Zembower
Unix Administrator
Johns Hopkins University/Center for Communications Programs
111 Market Place, Suite 310
Baltimore, MD  21202
410-659-6139

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How many arguments can perl take?

2001-11-28 Thread Luke Bakken

Just to clarify the command:

find -iname *.*htm* -o -iname *.stm | \
xargs egrep -l \
centernet\.jhuccp\.org/cgi-bin/mail2friend|cgi\.jhuccp\.org/cgi-bin/mail2friend
| \

xargs perl -pi~ -es?http://.*\.jhuccp\.org(/cgi-bin/mail2friend)?\1?g;

-

first off, why are you including the egrep statement?  if it is to weed
out files only containing the line:

centernet.jhuccp.org/cgi-bin/mail2friend
or
cgi.jhuccp.org/cgi-bin/mail2friend

why not do this in your perl script, and leave out the egrep (split
across two lines for readibility):

perl -pi~ -e's?http://(?:centernet|cgi)\.jhuccp\.org
/cgi-bin/mail2friend?/cgi-bin/mail2friend?g;'

Also for perl one-liners, it's usually best to enclose them in single
quotes, and then use q() or qq() inside the one-liner for single and
double quotes, respectively.

Also, the backreference is unnecessary as your captured string is just a
literal string.

Let me know if this helps your problem.
Luke

 It seems to run fine and changes many files, but when I go searching
 for the string that was supposed to be changed, I keep finding more
 file. Many were changed correctly, but some were not.

 It strikes me that maybe perl can't take too many arguments at once.
 There are options to the xarg command that allow no more than so many
 arguments at a time to be passed. Is this what's wrong? What should I
 set the number of arguments to?

 Thanks for trying to help me with this.

 -Kevin Zembower

 -
 E. Kevin Zembower
 Unix Administrator
 Johns Hopkins University/Center for Communications Programs
 111 Market Place, Suite 310
 Baltimore, MD  21202
 410-659-6139

 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: OO Perl programming.

2001-11-28 Thread terrence

Thanks, that's what I needed.

thanks again.

Cheers,
Terrence

-Original Message-
From: Adam Turoff [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 28, 2001 10:19 PM
To: Terrence Chan
Cc: [EMAIL PROTECTED]
Subject: Re: OO Perl programming.


On Wed, Nov 28, 2001 at 04:54:53PM +0800, Terrence Chan wrote:
 I'm new to OO Perl and I wonder if it is possible to implement Sigleton
 pattern in OO perl. And how it is implemented.
 
 Any info/pointer is welcomed.

Check out search.cpan.org for singleton.  You'll find this:

http://search.cpan.org/doc/ABW/Class-Singleton-1.03/Singleton.pm

DESCRIPTION

This is the Class::Singleton module. A Singleton describes
an object class that can have only one instance in any
system. An example of a Singleton might be a print spooler
or system registry. This module implements a Singleton
class from which other classes can be derived. By itself,
the Class::Singleton module does very little other than
manage the instantiation of a single object. In deriving
a class from Class::Singleton, your module will inherit
the Singleton instantiation method and can implement whatever
specific functionality is required.

For a description and discussion of the Singleton class,
see Design Patterns, Gamma et al, Addison-Wesley, 1995,
ISBN 0-201-63361-2.

Z.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Question

2001-11-28 Thread William.Ampeh

Hello,

Can anyone tell me why he/she will choice PERL over PHP?

What is the difference between mysql and MySQL  (case sensitivity)?

Lastly what is a good book for a developer who is interested in
implementing
a WEB-based database using MySQL and PERL?

PS:  I have the Paul DuBois book on MySQL and Perl for the WEB,
which is very good, but I am looking for a second source of reference.

__

William Ampeh (x3939)
Federal Reserve Board


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Sorting a Hash

2001-11-28 Thread Wagner-David

Here is a start:
You would pull from the hash, but easier for testing to just use __DATA__ and 
using map , I have the following setup:
0 - the date
1 - month
2 - day
3 - year
So you compare first vs year, then if necessary to month followed by day.
Like I say, a start for you.

foreach my $key (sort { $a-[3] = $b-[3] || $a-[1] = $b-[1] || $a-[2] = 
$b-[2]} map{ [ $_, /^(\d+).(\d+).(\d+)/ ] } DATA) {
   printf %-s, $key-[0];
 }
 
__DATA__
12/01/01
02/01/02
11/15/01
12/14/00
^Script ends here

Output:
12/14/00
11/15/01
12/01/01
02/01/02

Wags ;)


-Original Message-
From: Pellerin, Dale [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 28, 2001 08:03
To: [EMAIL PROTECTED]
Subject: Sorting a Hash


I am very new to hashes (as well as Perl) and am having some difficulty with
a cgi script.  This script allows individuals to post announcements via a
form.  The form data is stored in a text file, sorted in descending order by
date, and printed to the html page.  However, the script is currently
sorting by the month and not by the year, thus creating a problem when news
items are posted from 2002. (01/01/02 news items are being printed below
12/01/01 news items)

Here is a sample of the text file that the data is stored in:

http://is-blah.com/corprate/pages/news/cafeteria_closed.htm ~ 10/24/01 ~
Cafeteria closed

Here is  a snippet of code from the cgi script that sorts the file:

# Hash to sort date
$from = tmc.dat;
my %h;  

open(FILE, $from) || die Can't open $from!\n;
while (FILE) {
   chomp;
   ($announcement,$date,$description) = split(/~/,$_);
   
   # if the date has already been seen, tack this entry on to the hash value
if( $h{$date} ){ 
$h{$date} .= |$announcement~$description;
}

# date hasn't been seen, so create a new hash entry
else
{
$h{$date} = $announcement~$description;
}
}

#sort the dates in desc. order
foreach $key (sort {$b cmp $a} keys %h)
{
   #do for each item for that date
@items = split '\|', $h{$key};
foreach $item (@items)
{
#split back out the values and print the table
my($announcement,$description) = split /~/,$item;
print table width=800tr;
print tdimg border=0 width=14 height=14 id='_x_i1027'
src='http://is-web/corprate/gifs/blueball.gif';
print ALIGN='left'span style='font-size:13.5pt'a
href=\$announcement\font color=blue$description/font/a(font
color=black $key)/font/td;
print /tr/tablebr;

I would appreciate any assistance in figuring out how to sort by year, then
by month.  

Thank you.

Dale

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Question

2001-11-28 Thread Adam Turoff

On Wed, Nov 28, 2001 at 12:38:48PM -0500, [EMAIL PROTECTED] wrote:
 Can anyone tell me why he/she will choice PERL over PHP?

There are lots of reasons.  The most important reason to use Perl 
instead of PHP is that Perl is useful in many areas - web programming
as well as system administration and automation of routine tasks.
PHP on the other hand is amost exclusively used with web programming only.

If you use Perl, there are many more ways you can apply your knowledge.
Not everything is a web app after all.

 What is the difference between mysql and MySQL  (case sensitivity)?

Just a difference in casing.  MySQL is the proper casing, but there's
nothing wrong with mysql.

 Lastly what is a good book for a developer who is interested in
 implementing
 a WEB-based database using MySQL and PERL?
 
 PS:  I have the Paul DuBois book on MySQL and Perl for the WEB,
 which is very good, but I am looking for a second source of reference.

Pretty soon you'll need a good book on Perl and another good book on
MySQL / databases.  There is no one good MySQL+Perl book out there that
will answer all of your questions or show you all of the concepts you 
need to master.

Z.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Question

2001-11-28 Thread Kevin Meltzer

On Wed, Nov 28, 2001 at 12:38:48PM -0500, [EMAIL PROTECTED] 
([EMAIL PROTECTED]) said something similar to:
 Hello,
 
 Can anyone tell me why he/she will choice PERL over PHP?

Personally, I didn't like using PHP when I *had* to. No sir, I didn't like it.
This was a recent thread on the beginners-cgi list. To get some opinions taks a
peek at the archive:

http://archive.develooper.com/beginners-cgi%40perl.org/msg03121.html
http://archive.develooper.com/beginners-cgi%40perl.org/msg03117.html

 What is the difference between mysql and MySQL  (case sensitivity)?

Unless I missed a new product along the line, mysql is just a non-correct-case
for MySQL.

 Lastly what is a good book for a developer who is interested in
 implementing
 a WEB-based database using MySQL and PERL?

(Shameless plug...) Writing CGI Applications with Perl

Cheers,
Kevin

-- 
[Writing CGI Applications with Perl - http://perlcgi-book.com]
I do remain confident in Linda. She'll make a fine labor secretary. From what
I've read in the press accounts, she's perfectly qualified.
-- G.W. Bush, Austin, TX 01/08/2001

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Makefile.pl on AIX

2001-11-28 Thread Rajib Mukherjee

i need to edit the Makefile.pl on AIX
anybody knows how to
i have install_p perl from the .bff of aix
i need to edit to set the LD_RUN_PATH
i am getting error cant load Oracle.so; without being
able to do this
any help ??
rajib

__
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How many arguments can perl take?

2001-11-28 Thread KEVIN ZEMBOWER

Thank you for your help, Luke, in clarifying my one-liner. I'm not the
best perl hacker and welcome the chance to learn from other who are.

I used the egrep to get only the files with cgimail2friend or
centernet...mail2friend in them. I thought I had earlier tried something
like you suggested, leaving out the egrep and put the search in the
perl, and perl generated a file ending in ~ for each file it read,
whether or not it had made the substitution. I didn't want it to
duplicate all my HTML pages. I could be not remembering this correctly,
however.

If I understand your suggestion on quotes in one-liners, I should have
written:
perl -pi~ -e's?http://.*\.jhuccp\.org(/cgi-bin/mail2friend)?\1?g;'
I don't have any quotes inside my expression. Are you making this
suggestion for my future cases, or have I not understood you correctly?

On the use of the backreference, are you saying I could have written:
perl -pi~
-es?http://.*\.jhuccp\.org(/cgi-bin/mail2friend)?/cgi-bin/mail2friend?g;
I agree, but that's SO much typing.  :)

Thanks, again for your suggestions.

-Kevin Zembower

 Luke Bakken [EMAIL PROTECTED] 11/28/01 12:05PM 
Just to clarify the command:

find -iname *.*htm* -o -iname *.stm | \
xargs egrep -l \
centernet\.jhuccp\.org/cgi-bin/mail2friend|cgi\.jhuccp\.org/cgi-bin/mail2friend
| \

xargs perl -pi~
-es?http://.*\.jhuccp\.org(/cgi-bin/mail2friend)?\1?g;

-

first off, why are you including the egrep statement?  if it is to
weed
out files only containing the line:

centernet.jhuccp.org/cgi-bin/mail2friend
or
cgi.jhuccp.org/cgi-bin/mail2friend

why not do this in your perl script, and leave out the egrep (split
across two lines for readibility):

perl -pi~ -e's?http://(?:centernet|cgi)\.jhuccp\.org
/cgi-bin/mail2friend?/cgi-bin/mail2friend?g;'

Also for perl one-liners, it's usually best to enclose them in single
quotes, and then use q() or qq() inside the one-liner for single and
double quotes, respectively.

Also, the backreference is unnecessary as your captured string is just
a
literal string.

Let me know if this helps your problem.
Luke

 It seems to run fine and changes many files, but when I go searching
 for the string that was supposed to be changed, I keep finding more
 file. Many were changed correctly, but some were not.

 It strikes me that maybe perl can't take too many arguments at once.
 There are options to the xarg command that allow no more than so
many
 arguments at a time to be passed. Is this what's wrong? What should
I
 set the number of arguments to?

 Thanks for trying to help me with this.

 -Kevin Zembower

 -
 E. Kevin Zembower
 Unix Administrator
 Johns Hopkins University/Center for Communications Programs
 111 Market Place, Suite 310
 Baltimore, MD  21202
 410-659-6139

 --
 To unsubscribe, e-mail: [EMAIL PROTECTED] 
 For additional commands, e-mail: [EMAIL PROTECTED] 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Question

2001-11-28 Thread Etienne Marcotte

First question:

Perl all the way (well you're on a perl mailing list)
But your Perl knowledge will be useful everywhere. I tought I'd vener
need perl for other things than my website, and finally ended up to use
it (on win2k) to change every occurence of a word in many files, to
create index files from other contents, etc etc.

There are tons of tutorials/documentation/help/mailing lists for Perl

There are many modules written so you don't have to reinvent the wheel
everytime.

There is mod_perl for ultimate perl performance:)

Second question:

As stated, you'll soon need to use several books.

MySQL and Perl for the web is a good start, I just read it last week. It
shows some good tricks, but there is a little too much imo. Let me
explain:

They show how useful it can be to use table definition in order to have
automated drop down menus and such, but IMO if your site structure is
not that complex and generates significant trafic, you'll have a lot of
reading for this (ex: You read the 48 states from the table definition
instead of the script.. this makes a query each time the drop is needed
and it's not likely to change soon)
Also, I found there is way too much CGI printing. Well the book is made
of CGI, which I don't like and don't use. I like to make my prints with
the complete tags/tags and control the ident if the result html
file, I like to set semi complex css atributes, etc.
The book is still great, I read it pretty fast since most of the stuff
in it I had already learned it from reading FAQs on the net and reading
the dbi-users mailing list. Some little tricks are good to know.

For a start at database design is a book called Database design for
mere mortal
A good DB layout is the key to good data tracking.
You should take twice the time to create the database because correcting
layout errors once on production is pretty long/hard

Then in MySQL..
There is the bible MySQL from Paul Dubois' that is good with many
examples, but since versions of mySQL changes everytime, you may read
the mysql manual at http://www.mysql.com/documentation/index.html

Then I'd move to Perl
I'd suggest to read learning perl from o'reilly then programming
perl from o'reilly as well.

Then I'd move to DBI if needed
There is once again a DBI book from alligator descartes clled Perl DBI
which is pretty small and fast to read. This once tho you can get a lot
of info by yourself on the internet and by looking at examples, because
using DBI is not too hard, and Paul Dubois' book that you have covers
plenty of DBI.

My 2 cents

Sorry for the long post

Etienne

Adam Turoff wrote:
 
 On Wed, Nov 28, 2001 at 12:38:48PM -0500, [EMAIL PROTECTED] wrote:
  Can anyone tell me why he/she will choice PERL over PHP?
 
 There are lots of reasons.  The most important reason to use Perl
 instead of PHP is that Perl is useful in many areas - web programming
 as well as system administration and automation of routine tasks.
 PHP on the other hand is amost exclusively used with web programming only.
 
 If you use Perl, there are many more ways you can apply your knowledge.
 Not everything is a web app after all.
 
  What is the difference between mysql and MySQL  (case sensitivity)?
 
 Just a difference in casing.  MySQL is the proper casing, but there's
 nothing wrong with mysql.
 
  Lastly what is a good book for a developer who is interested in
  implementing
  a WEB-based database using MySQL and PERL?
 
  PS:  I have the Paul DuBois book on MySQL and Perl for the WEB,
  which is very good, but I am looking for a second source of reference.
 
 Pretty soon you'll need a good book on Perl and another good book on
 MySQL / databases.  There is no one good MySQL+Perl book out there that
 will answer all of your questions or show you all of the concepts you
 need to master.
 
 Z.
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Etienne Marcotte
Specifications Management - Quality Control
Imperial Tobacco Ltd. - Montreal (Qc) Canada
514.932.6161 x.4001

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




a beginners challenge

2001-11-28 Thread Zysman, Roiy


 Hi All,
 Why not make a little challenge ..
 Lets see who can write the most lean ,mean , elegant , powerful, poetic
 (but most important)  _Shortest_, script that cleans from a directory
 files that are at least 3 days old.
 Good luck all,
 You're welcome to pick who you think is the winner.
 Roiy
 
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: a beginners challenge

2001-11-28 Thread Mike Rapuano

Huh, sounds fishy...

Good try;)

M.

-Original Message-
From: Zysman, Roiy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 28, 2001 1:19 PM
To: '[EMAIL PROTECTED]'
Subject: a beginners challenge



 Hi All,
 Why not make a little challenge ..
 Lets see who can write the most lean ,mean , elegant , powerful,
poetic
 (but most important)  _Shortest_, script that cleans from a directory
 files that are at least 3 days old.
 Good luck all,
 You're welcome to pick who you think is the winner.
 Roiy
 
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




deleting white spaces

2001-11-28 Thread Pedro A Reche Gallardo

Hi all,  I would like to delete all single white spaces from a string
without deleting concatenated white spaces. An example:
$string= I want to delete all this spaces, but  this

The result would be:

$string = Iwanttodeleteallthisspacesbutthis

Any idea welcomed.

Cheers


***
PEDRO A. RECHE , pHD TL: 617 632 3824
Dana-Farber Cancer Institute,FX: 617 632 4569
Harvard Medical School,  EM: [EMAIL PROTECTED]
44 Binney Street, D1510A,EM: [EMAIL PROTECTED]
Boston, MA 02115 URL: http://www.reche.org
***





RE: a beginners challenge

2001-11-28 Thread Michael Eggleton

Yup sounds fishy...
Plus it's elegant done in Java, Perls good, but elegant is Java.


Michael D. Eggleton
http://www.gorealnetworks.com
mailto:[EMAIL PROTECTED]


-Original Message-
From: Mike Rapuano [EMAIL PROTECTED]
To: Zysman, Roiy [EMAIL PROTECTED], [EMAIL PROTECTED]
Date: Wed, 28 Nov 2001 13:24:44 -0500
Subject: RE: a beginners challenge

 Huh, sounds fishy...
 
 Good try;)
 
 M.
 
 -Original Message-
 From: Zysman, Roiy [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 28, 2001 1:19 PM
 To: '[EMAIL PROTECTED]'
 Subject: a beginners challenge
 
 
 
  Hi All,
  Why not make a little challenge ..
  Lets see who can write the most lean ,mean , elegant , powerful,
 poetic
  (but most important)  _Shortest_, script that cleans from a
 directory
  files that are at least 3 days old.
  Good luck all,
  You're welcome to pick who you think is the winner.
  Roiy
  
  
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: deleting white spaces

2001-11-28 Thread RArul

Let me give it a shot...How about this?
--Rex

$string = I want to delete all this spaces, but  this;
$string =~ s/\s{1}(?=\w)//g;
print $string;



 -Original Message-
 From: Pedro A Reche Gallardo [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 28, 2001 1:06 PM
 To: [EMAIL PROTECTED]
 Subject: deleting white spaces
 
 
 Hi all,  I would like to delete all single white spaces from a string
 without deleting concatenated white spaces. An example:
 $string= I want to delete all this spaces, but  this
 
 The result would be:
 
 $string = Iwanttodeleteallthisspacesbutthis
 
 Any idea welcomed.
 
 Cheers
 
 
 **
 *
 PEDRO A. RECHE , pHD TL: 617 632 3824
 Dana-Farber Cancer Institute,FX: 617 632 4569
 Harvard Medical School,  EM: [EMAIL PROTECTED]
 44 Binney Street, D1510A,EM: [EMAIL PROTECTED]
 Boston, MA 02115 URL: http://www.reche.org
 **
 *
 
 
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: a beginners challenge

2001-11-28 Thread Etienne Marcotte

Sound like an assignment for school

Etienne

Mike Rapuano wrote:
 
 Huh, sounds fishy...
 
 Good try;)
 
 M.
 
 -Original Message-
 From: Zysman, Roiy [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 28, 2001 1:19 PM
 To: '[EMAIL PROTECTED]'
 Subject: a beginners challenge
 
  Hi All,
  Why not make a little challenge ..
  Lets see who can write the most lean ,mean , elegant , powerful,
 poetic
  (but most important)  _Shortest_, script that cleans from a directory
  files that are at least 3 days old.
  Good luck all,
  You're welcome to pick who you think is the winner.
  Roiy
 
 
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Etienne Marcotte
Specifications Management - Quality Control
Imperial Tobacco Ltd. - Montreal (Qc) Canada
514.932.6161 x.4001

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: a beginners challenge

2001-11-28 Thread Bob Showalter

 -Original Message-
 From: Zysman, Roiy [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 28, 2001 1:19 PM
 To: '[EMAIL PROTECTED]'
 Subject: a beginners challenge



  Hi All,
  Why not make a little challenge ..
  Lets see who can write the most lean ,mean , elegant ,
 powerful, poetic
  (but most important)  _Shortest_, script that cleans from a
 directory
  files that are at least 3 days old.

$ find /dir -mtime +3 -exec rm {} \;

  Good luck all,

Gee, thanks.

  You're welcome to pick who you think is the winner.

OK, I pick myself. What do I win?

  Roiy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: deleting white spaces

2001-11-28 Thread Jenda Krynicky

 Let me give it a shot...How about this?
 --Rex
 
 $string   = I want to delete all this spaces, but  this;
 $string   =~ s/\s{1}(?=\w)//g; print $string;

1) I bleive you meant \S and not \w

$string =~ s/\s{1}(?=\S)//g; print $string;

2) It doesn't work correctly.

You will delete the last one of the spaces in each group.

What about

$string =~ s/( *)/((length($1)  1) ? $1 : '')/ge;
print $string,\n;

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: The below CGI script creates my dataform.html but when I open it theres no contents;ie Candidate: $candidate etc

2001-11-28 Thread AMORE,JUAN (HP-Roseville,ex1)

Any takers on this one:)


 Subject:  The below CGI script creates my dataform.html but when I
 open it theres no contents;ie Candidate: $candidate etc
 
 Hello Everyone,
 Any hints on how to send data into this file dataform.html file to
 append and update its contents..
 I'm trying to write code to capture the values from a URL address line and
 have them sent
 to a file to be entered and appended for me to view later.
 The below code is what I'm trying to debug,because I can't get these
 values John,Technician  BSdegree
 from the following URL string
 candidate=Johnposition=Technicianeducation=BSdegree
 to get added to the dataform.html file.
 This script creates the file dataform.html file but no values are
 contained...
 Any ideas,
 
 #!/usr/bin/perl -w
 
 use strict;
 sub url_decode { # capture the values from the URL command line
 my $text = shift();
 $text =~ tr/\+/ /; # substitute the + for spaces
 $text =~ s/%([a-f0-9][a-f0-9])/chr( hex( $1 ) )/eg; # clean up URL
 string
 
 use CGI;
 
 # set my paramenters
 my $q = new CGI;
 my $candidate = $q-param('candidate');
 my $position = $q-param('position');
 my $education = $q-param('education');
 
 # send the values from my URL command line to the dataform.html to be
 added and appended:
 
 open(OUT,  dataform.html) or die Can't open file: $!;
 print Candidate: $candidate\n;
 print Position: $position\n;
 print Education: $Education\n\n;
 close OUT;
 
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: The below CGI script creates my dataform.html but when I openit theres no contents;ie Candidate: $candidate etc

2001-11-28 Thread Etienne Marcotte

Put the file handle where to print:

=

#!/usr/bin/perl -w

use strict;

# No need to decode, CGI makes it for you!

use CGI;

# no need to set if you don't modify them
my $q = new CGI;

open(OUT,  dataform.html) or die Can't open file: $!;
print OUT Candidate: $q-param('candidate')\n;
print OUT Position: $q-param('position')\n;
print OUT Education: $q-param('education')\n\n;
close OUT;

=

Untested, use at your own risks:)

Etienne

AMORE,JUAN (HP-Roseville,ex1) wrote:
 
 Any takers on this one:)
 
  Subject:  The below CGI script creates my dataform.html but when I
  open it theres no contents;ie Candidate: $candidate etc
 
  Hello Everyone,
  Any hints on how to send data into this file dataform.html file to
  append and update its contents..
  I'm trying to write code to capture the values from a URL address line and
  have them sent
  to a file to be entered and appended for me to view later.
  The below code is what I'm trying to debug,because I can't get these
  values John,Technician  BSdegree
  from the following URL string
  candidate=Johnposition=Technicianeducation=BSdegree
  to get added to the dataform.html file.
  This script creates the file dataform.html file but no values are
  contained...
  Any ideas,
 
  #!/usr/bin/perl -w
 
  use strict;
  sub url_decode { # capture the values from the URL command line
  my $text = shift();
  $text =~ tr/\+/ /; # substitute the + for spaces
  $text =~ s/%([a-f0-9][a-f0-9])/chr( hex( $1 ) )/eg; # clean up URL
  string
 
  use CGI;
 
  # set my paramenters
  my $q = new CGI;
  my $candidate = $q-param('candidate');
  my $position = $q-param('position');
  my $education = $q-param('education');
 
  # send the values from my URL command line to the dataform.html to be
  added and appended:
 
  open(OUT,  dataform.html) or die Can't open file: $!;
  print Candidate: $candidate\n;
  print Position: $position\n;
  print Education: $Education\n\n;
  close OUT;
 
 
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Etienne Marcotte
Specifications Management - Quality Control
Imperial Tobacco Ltd. - Montreal (Qc) Canada
514.932.6161 x.4001

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: deleting white spaces

2001-11-28 Thread Jeff 'japhy' Pinyan

On Nov 28, Pedro A Reche Gallardo said:

Hi all,  I would like to delete all single white spaces from a string
without deleting concatenated white spaces. An example:
$string= I want to delete all this spaces, but  this

The result would be:

$string = Iwanttodeleteallthisspacesbutthis

I suggest a negative look-behind and a negative look-ahead:

  $string =~ s/(?!\s)\s(?!\s)//g;

But that might take too long, since it's probably not optimized the way it
should be.  So I'd probably go with:

  $string =~ s/(\s+)/length($1) == 1 and $1/eg;

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: deleting white spaces

2001-11-28 Thread Ahmed Moustafa Ibrahim Ahmed

Rex,

Would you explain your regexp, please? Also, what do you think about this:
$string =~ s/([^\s])\s([^\s])/$1$2/g;

Thanks,

Ahmed

On Wed, 28 Nov 2001 [EMAIL PROTECTED] wrote:

 Let me give it a shot...How about this?
 --Rex
 
 $string   = I want to delete all this spaces, but  this;
 $string   =~ s/\s{1}(?=\w)//g;
 print $string;
 
 
 
  -Original Message-
  From: Pedro A Reche Gallardo [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, November 28, 2001 1:06 PM
  To: [EMAIL PROTECTED]
  Subject: deleting white spaces
  
  
  Hi all,  I would like to delete all single white spaces from a string
  without deleting concatenated white spaces. An example:
  $string= I want to delete all this spaces, but  this
  
  The result would be:
  
  $string = Iwanttodeleteallthisspacesbutthis
  
  Any idea welcomed.
  
  Cheers
  
  
  **
  *
  PEDRO A. RECHE , pHD TL: 617 632 3824
  Dana-Farber Cancer Institute,FX: 617 632 4569
  Harvard Medical School,  EM: [EMAIL PROTECTED]
  44 Binney Street, D1510A,EM: [EMAIL PROTECTED]
  Boston, MA 02115 URL: http://www.reche.org
  **
  *
  
  
  
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Question

2001-11-28 Thread Hasanuddin Tamir

On Wed, 28 Nov 2001, Kevin Meltzer [EMAIL PROTECTED] wrote,

  What is the difference between mysql and MySQL  (case sensitivity)?
 
 Unless I missed a new product along the line, mysql is just a non-correct-case
 for MySQL.

Doesn't anyone ever use the mysql client for MySQL?

san@pts2 mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 3.23.41

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql 


san
-- 
Trabas - http://www.trabas.com



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: deleting white spaces

2001-11-28 Thread Michael Fowler

On Wed, Nov 28, 2001 at 01:25:51PM -0500, [EMAIL PROTECTED] wrote:
 $string   = I want to delete all this spaces, but  this;
 $string   =~ s/\s{1}(?=\w)//g;
 print $string;

Almost, but it doesn't match his description.  Consider a few edge cases:

foo  bar  is changed to foo bar

This is due to the fact that you're only using a positive lookahead to
determine if it's a lone space.  You must take into account what's before
the space, as well, to determine if it's a lone space.


foo . bar is changed to foo .bar

This is due to the fact that you're doing the lookahead on \w when it should
be on \S, or possibly [^ ].


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How many arguments can perl take?

2001-11-28 Thread Michael Fowler

On Wed, Nov 28, 2001 at 11:48:30AM -0500, KEVIN ZEMBOWER wrote:
 find -iname *.*htm* -o -iname *.stm|xargs egrep -l
 
centernet\.jhuccp\.org/cgi-bin/mail2friend|cgi\.jhuccp\.org/cgi-bin/mail2friend|xargs
 perl -pi~ -es?http://.*\.jhuccp\.org(/cgi-bin/mail2friend)?\1?g;

Someone suggested you replace the egrep with a Perl equivalent; you can also
replace it with the -path or possibly -regex options to find.


 It seems to run fine and changes many files, but when I go searching
 for the string that was supposed to be changed, I keep finding more
 file. Many were changed correctly, but some were not.

Are you certain it's not because they were filtered out by your egrep? 
Check all of the files output by running just the find and egrep.  If those
have all been properly changed then your problem lies in the filter; if not,
then it may be an argument limit imposed by your OS (see below).

 
 It strikes me that maybe perl can't take too many arguments at once.
 There are options to the xarg command that allow no more than so many
 arguments at a time to be passed. Is this what's wrong? What should I
 set the number of arguments to?

perl can take as many arguments as there is memory to store them.  Your OS
may have some restriction on the number of arguments that can be passed to a
program; I would suggest using the xargs option you mentioned.

 
Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




SQL for DBI

2001-11-28 Thread William . Crain

Ok, I've been with the list now on and off for about 4 months.  I've seen
some DBI examples, but most only deal with extracting info from a database.
I want to create one.  Here's what I have:

I have a current shell script using SQLPlus that creates the database within
Oracle on our primary systems which run Solaris.  What I want to do is
convert this shell script into a perl script using DBI with a MS Access
database to support code development using the PC.  Here is a sample SQL
statements creating a given table

create table assetvessel
(   
  constraint PK_assetvessel primary key (scenario, name),
 --
  scenario   varchar2(16),
 -- name of the scenario
  name   varchar2(16),
 -- name of the instance within the class
  bearingnumber(3)
constraint C_assv_bearing
check (bearing between 0 and 359),
 -- bearing in integer degrees from guide ship
  deltascnumber(3)
 -- delta scenario flag
  g_name   varchar2(16),
 -- name of instance within the g_class
  range   number(4)
 constraint C_assv_range
 check (range between 0 and )
 -- nautical miles to the guide ship, 0 to 9,999 nm
);

What I have found so far is that in order to enable the primary key
constraint on the table, I have to move the PK_assetvessel definition to the
bottom of the table definition or it generates a DBI-prepare error and does
not work.  I also convert all of the varchar2 data types to char data types
and that work.  The number data types we are currently entering as integer
types, however we cannot get the constraints to work properly on these.  If
we remove the field constraints, DBI-prepare does not error and the table
is created, though there are no constraints on the data.

Anyone have any experience with this?


TIA,

Will

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: deleting white spaces

2001-11-28 Thread Ahmed Moustafa Ibrahim Ahmed

Michael,

You don't you need the line beginning and line termination in
s/(^|[^ ]) ([^ ]|$)/$1$2/g;

Would
s/([^ ]) ([^ ])/$1$2/g
be simpler?

Thanks,

Ahmed

- Original Message - 
From: Michael Fowler 
To: Pedro A Reche Gallardo 
Cc: [EMAIL PROTECTED] 
Sent: Wednesday, November 28, 2001 11:40 AM
Subject: Re: deleting white spaces


On Wed, Nov 28, 2001 at 01:06:19PM -0500, Pedro A Reche Gallardo wrote:
 Hi all,  I would like to delete all single white spaces from a string
 without deleting concatenated white spaces. An example:
 $string= I want to delete all this spaces, but  this
 
 The result would be:
 
 $string = Iwanttodeleteallthisspacesbutthis

Your example output doesn't match your description.  You say you want to
delete single spaces and nothing else, but your output doesn't show this.

Consider:
input:  I want to delete all this spaces, but  this
output: Iwanttodeleteallthisspacesbutthis

You've deleted the comma, and you actually have more whitespace in the
output.


Assuming your description is more correct than your example output, and the
example output should be:

Iwanttodeleteallthisspaces,but  this

Then I would suggest something like:

$_ = I want to delete all this spaces, but  this;
s/(^|[^ ]) ([^ ]|$)/$1$2/g;

It seems there should be a simpler way, perhaps without the $1 $2
replacement, but that's the best I came up with.


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: deleting white spaces

2001-11-28 Thread Jeff 'japhy' Pinyan

On Nov 28, Michael Fowler said:

$_ = I want to delete all this spaces, but  this;
s/(^|[^ ]) ([^ ]|$)/$1$2/g;

It seems there should be a simpler way, perhaps without the $1 $2
replacement, but that's the best I came up with.

My look-behind/ahead approach does, but I don't think it's an optimal
approach:

  s/(?!\s)\s(?!\s)//g;

But that's slow.  I suggest

  s/(\s+)/length($1)  1 and $1/eg;

That says:  if the length of $1 is greater than 1, replace it with itself,
otherwise, replace it with nothing.  (The X  Y returns '', not 0, for
false.)

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: deleting white spaces

2001-11-28 Thread Jeff 'japhy' Pinyan

On Nov 28, Ahmed Moustafa Ibrahim Ahmed said:

You don't you need the line beginning and line termination in
s/(^|[^ ]) ([^ ]|$)/$1$2/g;

Would
s/([^ ]) ([^ ])/$1$2/g
be simpler?

But it doesn't work in all cases:

  $_ = a ;
  s/([^ ]) ([^ ])/$1$2/g;
  print;  # a 

But the (^|[^x]) approach can be replaced by (?!x), and ([^x]|$) can be
replaced by (?!x).  See my other response.  This technique is NOT
optimized, so it's not very fast, so you should use the s///eg solution I
have provided.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: deleting white spaces

2001-11-28 Thread Michael Fowler

On Wed, Nov 28, 2001 at 11:56:30AM -0800, Ahmed Moustafa Ibrahim Ahmed wrote:
 You don't you need the line beginning and line termination in
 s/(^|[^ ]) ([^ ]|$)/$1$2/g;

It depends on what is desired in the two edge cases of  foobar and
foobar , and what version of Perl is being used.  I was assuming they
should both become foobar, thus the line beginning and ending assertions.
I was also assuming a version of Perl prior to 5.6.

Given a version of Perl 5.6 or greater, then the substitution could become:

s/(?! ) (?! )//g;

 
 Would
 s/([^ ]) ([^ ])/$1$2/g
 be simpler?

If the edge cases mentioned above should remain unchanged, then yes.


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: deleting white spaces

2001-11-28 Thread Jeff 'japhy' Pinyan

On Nov 28, Michael Fowler said:

On Wed, Nov 28, 2001 at 11:56:30AM -0800, Ahmed Moustafa Ibrahim Ahmed wrote:
 You don't you need the line beginning and line termination in
 s/(^|[^ ]) ([^ ]|$)/$1$2/g;

Given a version of Perl 5.6 or greater, then the substitution could become:

s/(?! ) (?! )//g;

That works in 5.005 too.  But I reiterate this approach ends up being
horrible on chunks of whitespace.  You might hope Perl is smart enough to
do something like:

  abc def ghi jkl mno
  ^
  |
 failed here, so
 jump to next chunk
 of whitespace

Too bad, Perl doesn't optimize this regex that way.  It tries matching at
EACH space in that   chunk, which is poor form. :(

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: a beginners challenge

2001-11-28 Thread Adam Turoff

On Wed, Nov 28, 2001 at 08:19:26PM +0200, Zysman, Roiy wrote:
  Lets see who can write the most lean ,mean , elegant , powerful, poetic
  (but most important)  _Shortest_, script that cleans from a directory
  files that are at least 3 days old.

perl -e 'chdir(shift @ARGV); sleep(3*86_400); unlink *;' ~

:-)

On Wed, Nov 28, 2001 at 01:36:44PM -0500, Bob Showalter wrote:
 $ find /dir -mtime +3 -exec rm {} \;

This is the canonical solution.  Your problem can be solved with perl, 
but perl isn't the best tool to solve your problem.  

Z.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: a beginners challenge

2001-11-28 Thread Sidharth Malhotra

He didn't specify perl.  So I guess this works.

-Original Message-
From: Bob Showalter [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, November 28, 2001 1:37 PM
To: 'Zysman, Roiy'; '[EMAIL PROTECTED]'
Subject: RE: a beginners challenge


 -Original Message-
 From: Zysman, Roiy [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 28, 2001 1:19 PM
 To: '[EMAIL PROTECTED]'
 Subject: a beginners challenge



  Hi All,
  Why not make a little challenge ..
  Lets see who can write the most lean ,mean , elegant ,
 powerful, poetic
  (but most important)  _Shortest_, script that cleans from a
 directory
  files that are at least 3 days old.

$ find /dir -mtime +3 -exec rm {} \;

  Good luck all,

Gee, thanks.

  You're welcome to pick who you think is the winner.

OK, I pick myself. What do I win?

  Roiy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CGI scripts security

2001-11-28 Thread Jonathan E. Paton


 Jonathan wrote:
 I don't think the shell is called to
 resolve the /home/users/me/web/$in
 {'NAME'}.ext bit, and therefore
 you cannot run commands with it.

 Randal wrote:
 It would be if $in{NAME} contained |\0.
 NULL characters terminate the string, and
 if | appears just before that, bingo, it's
 a shell command, not a file open.  Trivial
 to get:
   /cgi-bin/yourscript?NAME=%7C%00

 All that's needed now is to make that
 \n/evil/command|\0 instead.  I'll leave
 that up to the guy that's about to visit
 your site. :)

Ah, now there's one I forgot about.  AFAIK Perl handles
null characters perfectly (8 bit clean :), but many
programs based on C aren't (not properly checked).  It's
fine UNTIL perl uses it externally... might be good to
try, just in case Perl's magic does something about it.

Did anyone mention Taint mode?  It's really not that hard.

Going back to the original problem, I suggest you don't use
the filesystem at all.  A database might be safer in this
instance, and would be my preferred solution.  Creating
files based on unchecked (anonymous) user input just seems
stupid to me.  Alternatively setup the script in a chroot
enviroment, which is a little safer.

However, if it makes coding easier, and you can afford a
few hacks once and a while why not try tripwire - at least
you'll know when things have been changed.  (Bad advice...
fix the real problem before looking at security tools).

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and Music 
Charts
http://uk.my.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




email attachments

2001-11-28 Thread Jeff Norville

Looked through CPAN but didn't find anything specifically dealing with
receipt of attachments.

I basically want to parse an attachment for a PGP key.  Suggestions?

Jeff Norville
IVR Engineer
PreNet Corporation
503.944.4600 x308



PLEASE NOTE: This message, including any attachments, may include
privileged, confidential and/or inside information. Any distribution or use
of this communication by anyone other than the intended recipient(s) is
strictly prohibited and may be unlawful. If you are not the intended
recipient, please notify the sender by replying to this message and then
delete it from your system. Thank you.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




First Program ever

2001-11-28 Thread Shane Garza

Not just in perl  this is my first program ever.

I decided to look at perl first while immersed in awe.

I am posting this code for feedback and hopefully some positive feedback is
there, I just want to learn ;). So flame away, and try to create the same
logic in two lines if you can and that is not sarcastic. I can say that I
had fun, and it works.
#==#
#!/usr/bin/perl
sub order
{
tr/a-z/A-Z/, $_;
s/^\s{1}//g, $_;
s/\'//g, $_;
$ck = (s/\s+/,/g, $_);
@ct = split(/,/, $ck);
if ($ct[0] =~ (/^\s\d+/)  $ct[4] =~(/\d+/))
 {
  print SG $ct[1]\t$ct[2] $ct[3]\n;
  print SG $ct[4]\t$ct[5] $ct[6]\n;
  }
elsif ($ct[6] =~(/\d+\w/)  $ct[8] =~(/\w+/))
{
  print SG $ct[0]\t$ct[1] $ct[2]\n;
  print SG $ct[3]\t$ct[4] $ct[5]\n;
  print SG $ct[6]\t$ct[7] $ct[8]\n;
}
elsif ($ct[0] =~ (/\d+/)  $ct[3] =~ (/\d+/))
 {
  print SG $ct[0]\t$ct[1] $ct[2]\n;
  print SG $ct[3]\t$ct[4] $ct[5]\n;
  }
elsif ($ct[4] =~ (/\w+/)  $ct[5] =~(/\d+/))
 {
  print SG $ct[0]\t$ct[1] $ct[2] $ct[3] $ct[4]\n;
  print SG $ct[5]\t$ct[6] $ct[7]\n;
  }
elsif ($ct[2] =~ (/\d+/))
 {
  print SG $ct[0]\t$ct[1]\n;
  print SG $ct[2]\t$ct[3] $ct[4]\n;
  }

elsif ($ct[3] =~ (/\w+/)  $ct[4] =~ (/\d+/))
 {
  print SG $ct[0]\t$ct[1] $ct[2] $ct[3]\n;
  print SG $ct[4]\t$ct[5] $ct[6]\n;
  }
}
open (IN, /dir/file) || die missing infile $!; #any conforming input
file
open (SG, +/dir/ofile) || die missing file $!;#final output
while (IN)
  {
  if  (/^\d{0,3}\w\s\w+/)
{
order;
}
  elsif (/^\s\d+\w\s\w+/)
   {
order;
}
  }


 if you want to run this program  edit the directories, as if your the
beginner or something ;| 
At least every one will get a useful tab delmtd garbage pail collection for
mysql ;)
 BTW I am serious I know there is an easiar way, unfortunetaly this is how I
learn the best ..
Thx all
okay here is the file that it parses.

  Garbage Pail Kids
 10th Series


379a Locked Dorian   379b Sidney Kidney
380a Vermin Herman   380b Gullivered Travis
381a Ground Chuck381b Lean Jean
382a Good-Bye Hy 382b Farewell Mel
383a Itchy Mitch 383b Raked Jake
384a Flamin' Raymond 384b Hot Toddy
385a Phil 'Er Up 385b Chuckin Charlie
386a Snotty Dotty386b Frozen Flo
387a Fatty Maddie387b Cora Corset
388a Facey Tracie388b Heads Upton
389a Dira Rita   389b Overflow Joe
390a Conecting Dots  390b Twinny Vinnie
391a Glass Isaac 391b False Iris
392a Ann Chovie  392b Sardine Candice
393a Jess Express393b Choo-Choo Train
394a Barb Wire   394b Play Penny
395a Paved Dave  395b Run-Over Grover
396a Creamed Gene396b Clobbered Bob
397a Cleaned Up Clint397b Sucked Up Stefan
398a Skiin' Ian  398b Sheared Sherwood
399a Dirty Flora 399b Gina Cleaner
400a Varicose Wayne  400b Elaine Vain
401a Viv E. Section  401b Disect Ed
402a Lunchpail Gail  402b Lunchbox Stu
403a Hunter Punter   403b Fractured Francis
404a Airy Mary   404b Hissy Missie
405a Over-Ripe Melanie   405b Walter Melon
406a Shoppin Carter  406b Super Marcus
407a Cracked Sheldon 407b Wally Walnut
408a Lickin' Leon408b Rat-Sucker Randall
409a Tiltin' Milton  409b Amazing Mason
410a Scratchin Pole Paul 410b Clawed Claude
411a Van Pire411b Bud Sucker
412a Mixed-Up Trixie 412b Doughy Chioe
413a Barnyard barney 413b Dick Hick
414a Umbilical Coutney   414b Yo Yolanda
415a Erased Erica415b Wiped Out Winnie
416a Shootin' Newton 416b Sherman Tank
417a Hangin' Harriet 417b Swingin' Sophia

Series 10 Information:

Set Totals:  86 stickers (78 regular, plus 8 variations)

Variations:  379a and 379b have three different backs.
 385a, 385b, 408a, 408b have two different backs.


379a  Locked Dorian...three different backs:
   (1) puzzle L preview
   (2) Rob Slob  Double Iris
   (3) Zack Plaque  Still Jill

379b  Sidney Kidney...three different backs:
   (1) puzzle K preview
   (2) Rob Slob  Double Iris
   (3) Zack Plaque  Still Jill

385a  Phil 'Er Up.title of back feature (The Garbage Gang)
  found in both blue and red letters.

385b  Chuckin' Charliesame as 385a

408a  Lickin' Leon ...title of back feature (Garbage Pail Gang)
  found in both blue and red letters.

408b  Rat-Sucker Randall..same as 408a

  Garbage Pail Kids
 11th Series

418a Lucy Lock-It   418b Shut Up Shirley
419a Meg-A-Volt 419b Charged Marge
420a Spanked Hank   420b Spikey Sondra
421a Groovy Greg421b Combin' Harry

Getting rid of hash values I don't want..

2001-11-28 Thread Daniel Falkenberg

Hey all,

Currently I am working on the Linux /etc/passwd file.  Now I want to be
able to split the /etc/passwd file for example...

tunnel:x:503:503::/home/tunnel:/bin/bash
test:x:504:50:Test Account:/home/test:/bin/false
test2:x:507:502:Test Account:/home/test2:/bin/false
daniel:x:508:45:Thats Me:/home/daniel:/bin/false
*test6:x:509:45:Test Account:/home/test6:/bin/false

Now I have no trouble actually splitting the file but what I really want
to do is have all the values of $lines

$file = '/etc/passwd';

open PASSWD, $file or die $file: $!\n;
 while ($lines = PASSWD) {
@lines = split (/:/, $lines);
if ($lines[3] == 45 ) {
#Store all users and their gids in a hash!
$users{$lines[4]} = $lines[0];
}
  }
close PASSWD;

foreach $fullnames (keys %users) {
print $fullnames, \n;
}

foreach $usernames (values %users) {
print $usernames, \n;
}

Why is it the hash doesn't insert all the keys and values.  I get a
result that is complety wrong. Such as the following...

%users = (
   'Test Account' = 'test6'
 );

This is about all I get.  When we all know very well that the file
($file) contains alot more users with a GID of 45.  Can some one point
me into the right direction as to what I am doing wrong here?

Thx,

Dan

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Getting rid of hash values I don't want..

2001-11-28 Thread Daniel Falkenberg

List,

Just been playing around with the code a little more...

sub view_users{
  open PASSWD, $file or die $file: $!\n;
  while ($lines = PASSWD) {
@lines = split (/:/, $lines);
  if ($lines[3] == 45 ) {
  $users{$lines[0]} = $lines[4];
  }
  }
  return %users;
  close PASSWD;
}
view_users(%users);

Now the hash works fine...

%users = (
   'daniel' = 'Daniel Merritt',
   'test2' = 'Test Account',
   'test4' = 'test Account',
   'test6' = 'Test Account',
   'test' = 'Test Account'
 );

It populates the hash with everything I want but if I swap the
following...

from...

if ($lines[3] == 45 ) {
  $users{$lines[0]} = $lines[4];
}

to...

if ($lines[3] == 45 ) {
  $users{$lines[4]} = $lines[0];
}

it does what it did before.  Ie doesn't populate the hash correctly.

Any ideas?

Thx,

Dan

Hey all,

Currently I am working on the Linux /etc/passwd file.  Now I want to be
able to split the /etc/passwd file for example...

tunnel:x:503:503::/home/tunnel:/bin/bash
test:x:504:50:Test Account:/home/test:/bin/false
test2:x:507:502:Test Account:/home/test2:/bin/false
daniel:x:508:45:Thats Me:/home/daniel:/bin/false
*test6:x:509:45:Test Account:/home/test6:/bin/false

Now I have no trouble actually splitting the file but what I really want
to do is have all the values of $lines

$file = '/etc/passwd';

open PASSWD, $file or die $file: $!\n;
 while ($lines = PASSWD) {
@lines = split (/:/, $lines);
if ($lines[3] == 45 ) {
#Store all users and their gids in a hash!
$users{$lines[4]} = $lines[0];
}
  }
close PASSWD;

foreach $fullnames (keys %users) {
print $fullnames, \n;
}

foreach $usernames (values %users) {
print $usernames, \n;
}

Why is it the hash doesn't insert all the keys and values.  I get a
result that is complety wrong. Such as the following...

%users = (
   'Test Account' = 'test6'
 );

This is about all I get.  When we all know very well that the file
($file) contains alot more users with a GID of 45.  Can some one point
me into the right direction as to what I am doing wrong here?

Thx,

Dan

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: deleting white spaces

2001-11-28 Thread John W. Krahn

Jeff 'Japhy' Pinyan wrote:
 
 I suggest a negative look-behind and a negative look-ahead:
 
   $string =~ s/(?!\s)\s(?!\s)//g;
 
 But that might take too long, since it's probably not optimized the way it
 should be.  So I'd probably go with:
 
   $string =~ s/(\s+)/length($1) == 1 and $1/eg;
  
$string =~ s/(\s+)/length($1) != 1 and $1/eg;



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: open read write

2001-11-28 Thread Leon

How about this :-

open (SALARY,c:/salary) || die$!\n;
chomp (@read = SALARY);
close (SALARY);

$read = join '',@read;
$read = $read + 10;

open (SALARY,c:/salary) || die $!\n;
print SALARY $read;
close SALARY;

--- end of msg --


- Original Message -
From: nafiseh saberi [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 28, 2001 7:14 PM
Subject: open read write


hi all.
how r u ?
I wish all of you be fine and happy.

I want to ...
1- open an existing file
2- read the number that exist in it
3- add it with 10
4-write the result in file.
5- note: I want to earse the last number and write the result
 instead of it.

I write some code ..but doesn't work.

open (SALARY,-c:/salary);
 read (SALARY,$salary,5)
  $salary=$salary+10;

  print SALARY $salary;
  close SALARY;


would you help me to compelte it.
thx for annny help.
___

Nafiseh Saberi




_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: First Program ever

2001-11-28 Thread John W. Krahn

Shane Garza wrote:
 
 Not just in perl  this is my first program ever.
 
 I decided to look at perl first while immersed in awe.
 
 I am posting this code for feedback and hopefully some positive feedback is
 there, I just want to learn ;). So flame away, and try to create the same
 logic in two lines if you can and that is not sarcastic. I can say that I
 had fun, and it works.
 #==#
 #!/usr/bin/perl

#!/usr/bin/perl -w
use strict;


 sub order
 {
 tr/a-z/A-Z/, $_;

Where did you pick up this idiom?

tr/a-z/A-Z/;  # or $_ = lc $_

 s/^\s{1}//g, $_;

s/^\s//g;

 s/\'//g, $_;

s/'//g;

 $ck = (s/\s+/,/g, $_);
 @ct = split(/,/, $ck);

Why change spaces to commas and then split on commas, why not just split
on spaces?

my @ct = split;


 if ($ct[0] =~ (/^\s\d+/)  $ct[4] =~(/\d+/))
  {
 
 [snip rest of code]
 
  if you want to run this program  edit the directories, as if your the
 beginner or something ;| 
 At least every one will get a useful tab delmtd garbage pail collection for
 mysql ;)
  BTW I am serious I know there is an easiar way, unfortunetaly this is how I
 learn the best ..
 Thx all
 okay here is the file that it parses.
 
 [snip copious data]



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




floating point arithmetic

2001-11-28 Thread Sidharth Malhotra

I encountered a problem with floating point arithmetic that I'm afraid
may be causing greater calculation errors in my program.  The program
I'm writing calculates numerical solutions for ordinary differential
equations (http://sid.cwru.edu/perl/euler.pl).   What's happening is
that floating point storage is not rounding off properly and down the
line 
2.4 + 0.025 = 2.424999 instead of 2.425.  You can easily spot
the error in this short script:
 
my $num = 1;
my $add = 0.025;
while ($num  4) {
$num += $add;
print $count++ .   $num\n;
}
 
The resulting error in my particular differential equation is 2/10^15
which is fine exept the the error gets compounded over a few hundred
iterations.  Does anyone have any suggestions for how to improve upon
this?  I do understand that there are accuracy limitations with floating
pt. nums.
 
Thanks,
 
Sid.
-
Sidharth Malhotra
[EMAIL PROTECTED]
 



PERL instead of crontab

2001-11-28 Thread nafiseh saberi

hi all.
I wish ,all of you be hopefull and happy.

I write one program for control user in ISP 
(internet service provider)
with crontab.
it runs every 2 minutes and finish and
2 minutes later , run again 

in your mind..
how can I write it with perl ??

thx for your time.
thx alot.
_
  Best regards.  
  Nafiseh Saberi   
  www.iraninfocenter.net
  www.sorna.net

  Remember that :
  It is all in GOD's hands ,and
  He will always be there for you.




Re: 'vacation'

2001-11-28 Thread Johan Vromans

Scott R. Godin [EMAIL PROTECTED] writes:

 has anyone implemented a 'better version' of the vacation program for 
 themselves? 

From your message it is not quite clear whether your goal is to have
an improved vacation program, or do you want an intelligent mail
filter? For the latter, try Mail::Procmail on CPAN. It contains an
example program how to setup your own filters.

 Ideally, it should return the offending mail to postmaster@* (where * is 
 the supposed 'from' address)

Never do this, please! Spammers often have the habit of putting the
addresses of innocent internet citizens. This way the innocent party is
getting mailbombed. I know what I'm taling about -- it happened twice
with some of my accounts.

-- Johan

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: [MacPerl-AnyPerl] Re: 'vacation'

2001-11-28 Thread Noah Iliinsky

Scott R. Godin wrote:
 
 In article [EMAIL PROTECTED],
  [EMAIL PROTECTED] (Johan Vromans) wrote:
 
  Scott R. Godin [EMAIL PROTECTED] writes:
 
   has anyone implemented a 'better version' of the vacation program for
   themselves?
 
  From your message it is not quite clear whether your goal is to have
  an improved vacation program, or do you want an intelligent mail
  filter? For the latter, try Mail::Procmail on CPAN. It contains an
  example program how to setup your own filters.
 
   Ideally, it should return the offending mail to postmaster@* (where * is
   the supposed 'from' address)
 
  Never do this, please! Spammers often have the habit of putting the
  addresses of innocent internet citizens. This way the innocent party is
  getting mailbombed. I know what I'm taling about -- it happened twice
  with some of my accounts.
 
 This is one of the caveats I've wondered about while considering the
 idea.
 
 Perhaps it would be better to mail the postmaster at the originating
 mailserver if it's possible to extract that?
 

Checkout http://www.spamcop.net for all of the spam-spanking goodness
you crave.

Cheers, Noah

-- 
Noah Iliinsky
noah at geospiza dot com
Geospiza Inc.
(206) 633-4403

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Any quicker way of writing the following...?

2001-11-28 Thread Randal L. Schwartz

 Michael == Michael Fowler [EMAIL PROTECTED] writes:

Michael In that snippet you're accessing the hash %_, when you should be accessing
Michael the hash reference in $_, like so:

Michael for ($PASS{$PASSWD_NAME}) {
Michael $new_user = $$_{user};
Michael $new_pass = $$_{password};
Michael $new_fname = $$_{fname};
Michael $new_lname = $$_{lname};
Michael }

Or, to make it very clear that you're dereferencing:

for ($PASS{$PASSWD_NAME}) {
$new_user = $_-{user};
etc
}

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CGI scripts security

2001-11-28 Thread Randal L. Schwartz

 Jonathan == Jonathan e paton [EMAIL PROTECTED] writes:

Jonathan I don't think the shell is called to resolve the 
Jonathan /home/users/me/web/$in{'NAME'}.ext bit, and therefore
Jonathan you cannot run commands with it.

It would be if $in{NAME} contained |\0.  NUL characters terminate
the string, and if | appears just before that, bingo, it's a shell
command, not a file open.  Trivial to get:

/cgi-bin/yourscript?NAME=%7C%00

All that's needed now is to make that \n/evil/command|\0 instead.
I'll leave that up to the guy that's about to visit your site. :)

Never trust CGI params.
Never trust CGI params.
Never trust CGI params.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CGI scripts security

2001-11-28 Thread Randal L. Schwartz

 Kevin == Kevin Meltzer [EMAIL PROTECTED] writes:

Kevin Never trust anyone over 30

Presuming that's in Hex, sure. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: email attachments

2001-11-28 Thread Randal L. Schwartz

 Jeff == Jeff Norville [EMAIL PROTECTED] writes:

Jeff PLEASE NOTE: This message, including any attachments, may include
Jeff privileged, confidential and/or inside information. Any distribution or use
Jeff of this communication by anyone other than the intended recipient(s) is
Jeff strictly prohibited and may be unlawful. If you are not the intended
Jeff recipient, please notify the sender by replying to this message and then
Jeff delete it from your system. Thank you.

You have exceeded the 4-line .sig boilerplate limit with a worthless
unenforcable disclaimer.  Please remove this text from future postings
to this mailing list.  If you cannot do so for mail from your domain,
please get a freemail account and rejoin the list from there.

For the record, your content was 164 characters, your .sig (although
not properly marked) was 64 characters (good!), and your completely
worthless disclaimer was 395 characters, more than double the content
of your message.  Feh.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]