Re: Hash of hashes

2001-07-30 Thread fliptop

Camilo Gonzalez wrote:
 
   $i=0;
   for $fields(split //, @data) {
   ($key, $value) = split /=/, $fields;
   $bigData{$model[$i]}{$key} = $value;
   $i++;
   }

why do i get the feeling when i look at this code that this person is
trying to parse a cgi query string without using cgi.pm?

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




Re: matching on a variable

2001-07-30 Thread fliptop

[EMAIL PROTECTED] wrote:
 
 ###
 open(LINKS, $statedir/links.dat) || die Error at LINKS: $!;
 @people = LINKS;
 $pattern_to_match = $vars::name;  #$vars::name is Harry, but the code

where are you declaring $vars::name?

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




RE: Hash of hashes

2001-07-30 Thread Peter Cornelius

This is the code that fails me:
  
   $i=0;
   for $fields(split //, @data) { 
   ($key, $value) = split /=/, $fields;
   $bigData{$model[$i]}{$key} = $value;
   $i++;
   }
  
 It won't print out @data or @model from anywhere inside the 
 for loop and
 won't print out specific dereferencing like $bigData{307}{Price}. 
  
 Any ideas anyone?

Hmmm.  I think split takes a string, or expression that evaluates to a
string, in its second argument.  That would mean that @data is being
evaluated in a scalar context.  When you evaluate an array in scalar context
you get the size, so you end up only looping once and only operating on an
integer (because the split would return the whole string since '' is
nowhere in it).  You could probably do this my nesting this in another
loop...

for $datum (@data) {
   $i=0;
   for $fields(split //, $datum) { 
   ($key, $value) = split /=/, $fields;
   $bigData{$model[$i]}{$key} = $value;
   $i++;
   }
}

I haven't run this so be ware.

Hope this helps,
Peter C.

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




Re: matching on a variable

2001-07-30 Thread Lisa Nyman

Hi,

Have you printed the variable $vars::name to be sure it contains what you
think it does?

Also, try the grep command:

open(LINKS, $statedir/links.dat) or die Error at LINKS: $!\n
my @all_matches = grep (/$vars::name/, LINKS);
print_link (@all_matches)

You can use arguments to grep to get inverse lists and such.

Lisa Wolfisch Nyman  [EMAIL PROTECTED]  IT Warrior Princess
Life is too short to wear ugly underwear.
Get the facts at http://quickfacts.census.gov/

On Mon, 30 Jul 2001 [EMAIL PROTECTED] wrote:

 How can I test whether a person's name (which is the variable called
 $vars::name) is in a particular file  ( links.dat)? The file is simply a
 list of names all separated by the newline character, i.e,
 
 open(LINKS, $statedir/links.dat) || die Error at LINKS: $!;
 @people = LINKS;
 $pattern_to_match = $vars::name;  #$vars::name is Harry, but the code
 won't find him
#$pattern_to_match = Harry; # the code will find Harry
 
 for (@people) {
   if ( /$pattern_to_match/) {
   print a match ;
} # end if
   else {
   print no match  ;
   print_link; # print a hyperlink to the home page
   } # end else
  } #end for loop




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




RE: matching on a variable

2001-07-30 Thread Peter Cornelius

 How can I test whether a person's name (which is the variable called
 $vars::name) is in a particular file  ( links.dat)? The 
 file is simply a
 list of names all separated by the newline character, i.e,
 
 Harry\n
 Joe\n
 Jane Doe\n
 
 When I change my pattern-to-match to the literal string I'm 
 testing for,
 say, Harry, the code works. But it NEVER finds $vars::name .


Have you looked at the grep function?  You might want something like...

  ...open file etc...

@names = FH;
@harrys = grep /harry/i, @names;

print Found , scalar @harrys,  Harrys in the file\n;

You can read up on it with perldoc -f grep. 

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




RE: Hash of hashes

2001-07-30 Thread Camilo Gonzalez

Fliptop,

Haven't studied all of CGI.pm's capability's yet. Is there an easier way to
build a hash of hashes using it?

-Original Message-
From: fliptop [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 30, 2001 11:46 AM
To: Camilo Gonzalez
Cc: '[EMAIL PROTECTED]'
Subject: Re: Hash of hashes


Camilo Gonzalez wrote:
 
   $i=0;
   for $fields(split //, @data) {
   ($key, $value) = split /=/, $fields;
   $bigData{$model[$i]}{$key} = $value;
   $i++;
   }

why do i get the feeling when i look at this code that this person is
trying to parse a cgi query string without using cgi.pm?

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




Re: Sendmail

2001-07-30 Thread Brett W. McCoy

On Mon, 30 Jul 2001, Adam Carson wrote:

 I have been trying to get a version of sendmail to send results from a
 form, and after finally getting all my addresses and formatting right,
 my mailserver gives me an error about not using the HELO protocol:

 X-Authentication-Warning: mail.server.IP.address:
   [the.user's.IP.address] didn't use HELO protocol

 The code from my script that mentions anything about HELO is:

 sendSMTP(1, HELO\n);
 sendSMTP(1, MAIL FROM: $mailFrom\n);
 sendSMTP(1, RCPT TO: $mailTo\n);
 sendSMTP(1, VRFY\n);
 sendSMTP(1, DATA\n);

You shouldn't have to be using anything that low-level to send email from
a script!  Are you actually binding to a socket to do this?

-- Brett


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




Re: Sendmail

2001-07-30 Thread Adam Carson

Yes, I am.
If you are suggesting that I use Mail::sendmail instead (are you?), the reason is that 
I got this code from Novell's website and it seemed to be a useful and easy to 
understand piece of code.  As a perl beginner, I also thought that understanding the 
process might be useful in the future... although I remember the discussion regarding 
hand-rolled CGI subs.  I would like to continue with my low level script unless 
there are valid security concerns regarding its use.  I will also look into 
Mail:sendmail as an alternative.  If I see that it is easier to use, I'll definitely 
switch.

  Adam Carson
MIS Department
 Berkeley County, SC

 Brett W. McCoy [EMAIL PROTECTED] 07/30/01 04:49PM 
On Mon, 30 Jul 2001, Adam Carson wrote:

 I have been trying to get a version of sendmail to send results from a
 form, and after finally getting all my addresses and formatting right,
 my mailserver gives me an error about not using the HELO protocol:

 X-Authentication-Warning: mail.server.IP.address:
   [the.user's.IP.address] didn't use HELO protocol

 The code from my script that mentions anything about HELO is:

 sendSMTP(1, HELO\n);
 sendSMTP(1, MAIL FROM: $mailFrom\n);
 sendSMTP(1, RCPT TO: $mailTo\n);
 sendSMTP(1, VRFY\n);
 sendSMTP(1, DATA\n);

You shouldn't have to be using anything that low-level to send email from
a script!  Are you actually binding to a socket to do this?

-- Brett


-- 
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: Sendmail

2001-07-30 Thread Brett W. McCoy

On Mon, 30 Jul 2001, Adam Carson wrote:

 If you are suggesting that I use Mail::sendmail instead (are you?),
 the reason is that I got this code from Novell's website and it seemed
 to be a useful and easy to understand piece of code.  As a perl
 beginner, I also thought that understanding the process might be
 useful in the future... although I remember the discussion regarding
 hand-rolled CGI subs.  I would like to continue with my low level
 script unless there are valid security concerns regarding its use.  I
 will also look into Mail:sendmail as an alternative.  If I see that it
 is easier to use, I'll definitely switch.

Actually, no I was suggesting using:

open(MAIL, | /usr/sbin/sendmail -oi -t) or die' Can't fork sendmail: $!\n;

print MSG;
...
MSG

I see no reason to explicitly set up the smtp server handshake unless you
are trying to create your own MTA or doing some other kinds of tricks with
your mail transport.

-- Brett

   http://www.chapelperilous.net/btfwk/

Q:  Why did the WASP cross the road?
A:  To get to the middle.



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




Embedding HTML in XML - Slightly OT

2001-07-30 Thread David Simcik

Hey folks,
I think this is a relatively simple question, but it has puzzled me a bit
lately. How does one embed fully marked up HTML data into an XML document
without accidentally parsing the HTML??? This is probably deceptively
simple, but I haven't a clue. ;-)

Thanks,
DTS


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




Re: Hash of hashes

2001-07-30 Thread fliptop



Camilo Gonzalez wrote:
 
 Fliptop,
 
 Haven't studied all of CGI.pm's capability's yet. Is there an easier way to
 build a hash of hashes using it?

i was just wondering.  is that what you're trying to do?

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




Re: Hash of hashes

2001-07-30 Thread fliptop

[reply posted to list]

Camilo Gonzalez wrote:
 
 Yes, Fliptop. I wrote that in my orignal email. Would appreciate any advice
 in that regard.

ok, good.  now, what is in the @model array?

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




Re: Sendmail

2001-07-30 Thread Karthik Krishnamurthy

HELO, EHLO need the domain you are connecting from


kat@graf-spee:~$ telnet localhost smtp
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 graf-spee.hn.extremix.net ESMTP Sendmail 8.11.3/8.11.3; Tue, 31 Jul 2001 08:17:58 
+0530
helo
501 5.0.0 helo requires domain address
helo localhost
250 graf-spee.hn.extremix.net Hello karthik@localhost [127.0.0.1], pleased to meet you 
 



/kk

On Mon, Jul 30, 2001 at 04:36:56PM -0400, Adam Carson wrote:
 I have been trying to get a version of sendmail to send results from a form, and 
after finally getting all my addresses and formatting right, my mailserver gives me 
an error about not using the HELO protocol:
 
 X-Authentication-Warning: mail.server.IP.address: 
   [the.user's.IP.address] didn't use HELO protocol
 
 The code from my script that mentions anything about HELO is:
 
 sendSMTP(1, HELO\n);
 sendSMTP(1, MAIL FROM: $mailFrom\n);
 sendSMTP(1, RCPT TO: $mailTo\n);
 sendSMTP(1, VRFY\n);
 sendSMTP(1, DATA\n);
 
 Any help would be appreciated.
 Thanks in advance,
 
   Adam Carson
 MIS Department
  Berkeley County, SC
 
 
 -- 
 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: COOKIES AGAIN...

2001-07-30 Thread Curtis Poe

--- Nigel Wetters [EMAIL PROTECTED] wrote:
 One of our partners ran into a problem with load balancing on IIS. Each server set a 
session
 cookie, which eventually pushed the useful cookies out of the browser's store. Yet 
another
 reason why IIS isn't ready for enterprise-level solutions.

While I definitely have some issues with IIS, this isn't one of them.  There is a 
domain limit to
cookies (20, I think) and a total limit (300, as I recall) that a browser is required 
to store,
according to standards.  While the browser may exceed those limits, it is in no way 
required to do
so.  If a particular site or application is having problems with too many cookies, 
it's due to
that site or domain poorly managing cookies and setting too many of them, not the 
necessarily the
Web server.

IIS does not set the cookies, so it's not to blame.  ASP might set them, with its 
session managing
tools, but that's still a configuration or programming issue and not a problem with 
IIS.

As for my issues with IIS, I am sick of having to switch to NPH scripts because it 
mangles headers
when setting cookies and doing a simultaneous redirect.  This bug has been in IIS for 
the LAST 3
VERSIONS!!!  You would think that MS would get it right after a while...

Cheers,
Curtis Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




how can an element in a array be deleted from a subroutine ?

2001-07-30 Thread Narendran Kumaraguru Nathan

Hai all,
   I have a local array and I wish to delete the last element of the array from the
subroutine. I pass the array as reference and tried as
pop(@array_neme);
this didn't work. Is there a way I can do it?
Thanks  Regards,
Naren.


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




AW: $1

2001-07-30 Thread Alessandro Lenzen

Well, uh, I didn't realise that it was basicly my fault.
I searched for something like this m/(\s\w+\s)/g in a string like This is a
test. Of course only  is  is found, although the g flag is set. The RegEx
scans the string an finds  is .
When Perl continues to scan for the RegEx, I think it restarts here, doesn't
it?

This is a test.
 ^

al

-Ursprüngliche Nachricht-
Von: Rachel Coleman [mailto:[EMAIL PROTECTED]]
Gesendet: Sonntag, 29. Juli 2001 19:57
An: [EMAIL PROTECTED]
Betreff: Re: $1


 Making a mistake once can be exused,
 making it twice is stupidity and
 making the same mistake a third time only proves you have no brain ;-)

 Sorry, I figured out where the problem is...

What was the problem and how did you fix it?  Other people reading the list
(or searching the archive) might have similar problems and want to know how
it was solved?  I'm curious, for one :)

Best wishes,

Rachel



--
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]




simple

2001-07-30 Thread Rahul Garg

Hello,

In my perl script , i am writing HTML code..within it i am using nbsp   for 
spaces , as i need a lot spaces is there any other solution.

Thanx in advance,
Rahul Garg.




[Fwd: Re: how can an element in a array be deleted from a subroutine ?]

2001-07-30 Thread Narendran Kumaraguru Nathan


Hai all,
   I have found it myself, using splice, it is working.
Naren.

Narendran Kumaraguru Nathan wrote:

 Hai all,
I have a local array and I wish to delete the last element of the array from the
 subroutine. I pass the array as reference and tried as
 pop(@array_neme);
 this didn't work. Is there a way I can do it?
 Thanks  Regards,
 Naren.

 --
 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: simple

2001-07-30 Thread Nigel G Romeril

A table can be a better solution

Rahul Garg wrote:

 Hello,

 In my perl script , i am writing HTML code..within it i am using nbsp   for 
spaces , as i need a lot spaces is there any other solution.

 Thanx in advance,
 Rahul Garg.


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




counting files of a directory

2001-07-30 Thread COLLINEAU Franck FTRD/DMI/TAM

Hello!

Is there a function which count the number of files in a directory ?

Thanks

Franck

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




Re: counting files of a directory

2001-07-30 Thread Sascha Kersken

Hi!

I'm not aware of a FUNCTION to do it, but this should work:

  DIR = opendir (path/to/dir);
  $count = 0;
  while (readdir DIR)
  {
 $count++;
  }

- afterwards, $count's value is the number of directory entries.


Sascha

--
Von: COLLINEAU Franck FTRD/DMI/TAM [EMAIL PROTECTED]
An: Perl (E-mail) [EMAIL PROTECTED]
Betreff: counting files of a directory
Datum: Mon, 30. Jul 2001 13:34 Uhr


 Hello!

 Is there a function which count the number of files in a directory ?

 Thanks

 Franck

 --
 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: counting files of a directory

2001-07-30 Thread Abdulaziz Ghuloum

Hello,

Try the glob function, or the * glob:

my $count = () = glob(/path/to/dir/*);

or

my $count = () = /path/to/dir/*;

Hope this helps,,,

Aziz,,,

In article
[EMAIL PROTECTED],
COLLINEAU [EMAIL PROTECTED] wrote:

 Hello!
 
 Is there a function which count the number of files in a directory ?
 
 Thanks
 
 Franck

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




Re: simple

2001-07-30 Thread Abdulaziz Ghuloum

Hello,

Did you know about the 'x' operator?

print 'nbsp;' x 50; # this will print nbsp 50 times.

Hope this helps,,,

Aziz,,,


In article 001c01c118dc$3926cb40$1900a8c0@shakti, Rahul Garg
[EMAIL PROTECTED] wrote:

 Hello,
 
 In my perl script , i am writing HTML code..within it i am using
 nbsp   for spaces , as i need a lot spaces is there any other
 solution.
 
 Thanx in advance,
 Rahul Garg.
 


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




RE: counting files of a directory

2001-07-30 Thread Amarnath Honnavalli Anantharamaiah

You can do it in this way

opendir(DIR, $some_dir) || die can't opendir $some_dir: $!;
@dots = readdir(DIR);
closedir DIR;
$num = @dots;  # num contains all types of files (directory files, link
files, ...)


opendir(DIR, $some_dir) || die can't opendir $some_dir: $!;
@dots = grep { -f $some_dir/$_ } readdir(DIR);
closedir DIR;
$num = @dots;  # $num will contain the number of ordianry files.


-Original Message-
From:   COLLINEAU Franck FTRD/DMI/TAM
[mailto:[EMAIL PROTECTED]]
Sent:   Monday, July 30, 2001 5:05 PM
To: Perl (E-mail)
Subject:counting files of a directory

Hello!

Is there a function which count the number of files in a directory ?

Thanks

Franck

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



The Information contained and transmitted by this E-MAIL is proprietary to 
Wipro Limited and is intended for  use only by the individual or entity to which 
it is addressed, and may contain information that is privileged, confidential or 
exempt from disclosure under applicable law. If this is a forwarded message, 
the content of this E-MAIL may not have been sent with the authority of the 
Company. If you are not the intended recipient, an agent of the intended 
recipient or a  person responsible for delivering the information to the named 
recipient,  you are notified that any use, distribution, transmission, printing, 
copying or dissemination of this information in any way or in any manner is 
strictly prohibited. If you have received this communication in error, please 
delete this mail  notify us immediately at [EMAIL PROTECTED] 




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


Re: simple

2001-07-30 Thread Brett W. McCoy

On Mon, 30 Jul 2001, Rahul Garg wrote:

 In my perl script , i am writing HTML code..within it i am using
 nbsp for spaces , as i need a lot spaces is there any other
 solution.

You still need to use nbsp; to make spaces.  However, the easy way to
create an arbitrary number of spaces is by using the x operator.  In fact,
you can make a little sub out of this:

sub spaces {

  my $num_spaces = shift;

  return ('nbsp;' x $num_space);

}

Personally, though, I think if you get to the point where you need to
cotnrol layout with spaces in this manner, you might want to move to using
a table -- it'll give you better control over the layout.

-- Brett

Brett W. McCoy
Software Engineer
Broadsoft, Inc.
240-364-5225
[EMAIL PROTECTED]


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




RE: counting files of a directory

2001-07-30 Thread Fennelly, Marion [ETHGB]

Hi

Suppose you just wanted to do files i.e. excluding directories?
Mazza

 -Original Message-
 From: Sascha Kersken [mailto:[EMAIL PROTECTED]]
 Sent: 30 July 2001 12:47
 To: COLLINEAU Franck FTRD/DMI/TAM
 Cc: [EMAIL PROTECTED]
 Subject: Re: counting files of a directory
 
 
 Hi!
 
 I'm not aware of a FUNCTION to do it, but this should work:
 
   DIR = opendir (path/to/dir);
   $count = 0;
   while (readdir DIR)
   {
  $count++;
   }
 
 - afterwards, $count's value is the number of directory entries.
 
 
 Sascha
 
 --
 Von: COLLINEAU Franck FTRD/DMI/TAM 
 [EMAIL PROTECTED]
 An: Perl (E-mail) [EMAIL PROTECTED]
 Betreff: counting files of a directory
 Datum: Mon, 30. Jul 2001 13:34 Uhr
 
 
  Hello!
 
  Is there a function which count the number of files in a directory ?
 
  Thanks
 
  Franck
 
  --
  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]
 



Problem...

2001-07-30 Thread COLLINEAU Franck FTRD/DMI/TAM

Hi!

I have a problem with that code:

#!/usr/bin/perl -w
use File::Copy;
opendir (LMI,lmi) || die impossible d'ouvrir lmi: $!;

$chaine='BEGIN PAPIER';


while($fichier=readdir LMI)

{
next if ($fichier eq '.' or $fichier eq '..');
open (FICHIER,lmi/$fichier) || die impossible d'ouvrir $fichier:
!$\n;
open(TEMP,+temp.htm)|| die impossible d'ouvrir temp.htm: $!\n;
print TEMP
!-\n;
$trouve=0;
while(FICHIER)
{
$trouve = 1 if($_=~m/$chaine/);
if ($trouve) 

{
(print TEMP $_)|| die écriture impossible dans
temp.htm $!\n;
}

}

copy(temp.html,$fichier) ;
close(FICHIER); 
close(TEMP);
}


When i use the debugger, i see that the programm doesn't come in the loop
while(FICHIER...

Why ?


Thanks !

Franck

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




Apache and HTML

2001-07-30 Thread debashis rana (JIC)

Hi

I made a HTML document using HTML-kit and I tidied it up with XHTML.  When I
run that HTML in Apache in Windows ME I got many compilation errors. When I
run the same  HTML in Internet Explorer I dont get any error. It works fine.
I was wondering if there is anything I need to do configure Apache to accept
HTML? 

Cheers,
Debashis


  -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, July 30, 2001 2:12 PM
 To:   [EMAIL PROTECTED]
 Subject:  beginners Digest 30 Jul 2001 13:11:43 - Issue 274
 
   File: ATT129296.txtMessage: Using Perl with Apache   
 Message: Re: Using Perl with ApacheMessage: Re: Using Perl with
 ApacheMessage: DELETING A COOKIEMessage: Re: DELETING A
 COOKIEMessage: PHP ListMessage: Re: PHP List   
 Message: Re: sending mail (learning perl program)Message: Re:
 sending mail (learning perl program)Message: Re: sending mail
 (learning perl program)Message: Re: CGI to rewrite a URL   
 Message: Re: Recursive find for a file within a directoryMessage:
 Re: Recursive find for a file within a directoryMessage: read
 query string with multiple values for same name?Message: Re: Mail
Message: Re: MailMessage: COOKIES AGAIN...Message:
 Re: COOKIES AGAIN...Message: how can an element in a array be
 deleted from a subroutine ?Message: AW: $1Message: simple
Message: Re: simpleMessage: Re: simpleMessage: Re:
 simpleMessage: [Fwd: Re: how can an element in a array be deleted
 from a subroutine ?]Message: counting files of a directory   
 Message: Re: counting files of a directoryMessage: Re: counting
 files of a directoryMessage: RE: counting files of a directory 
  Message: RE: counting files of a directory  

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




RE: [Fwd: Re: how can an element in a array be deleted from a subroutine ?]

2001-07-30 Thread Bob Showalter

 -Original Message-
 From: Narendran Kumaraguru Nathan [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, July 30, 2001 6:08 AM
 To: [EMAIL PROTECTED]
 Subject: [Fwd: Re: how can an element in a array be deleted 
 from a subroutine ?]
 
 
 
 Hai all,
I have found it myself, using splice, it is working.
 Naren.
 
 Narendran Kumaraguru Nathan wrote:
 
  Hai all,
 I have a local array and I wish to delete the last 
 element of the 
  array from the subroutine. I pass the array as reference 
 and tried as 
  pop(@array_neme); this didn't work. Is there a way I can do it?
  Thanks  Regards,
  Naren.

Note that pop() is just a special case of splice(), so using pop() should
work to remove the last element in an array.

You mention passing a reference to a sub, but your pop() call doesn't
dereference. A sub to remove the last element from an array would look like:

   sub remove_last
   {
  my $aref = shift;

  pop @$aref;  # note dereference
   }

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




Re: sending mail (learning perl program)

2001-07-30 Thread smoot

 Peter Scott [EMAIL PROTECTED] said:

 Yes, but if you create the above using something like
 
  open (MAIL, |/usr/sbin/sendmail $email)
 
 to which you should by the way add
 
  or die sendmail: $!\n;

I left the die off for brevity.  Good point.

 then you now need to validate $email to make sure that it isn't something like
 
  [EMAIL PROTECTED]; rm -rf /

Good point, given the perl open does shell-like expansions.

 Better to use
 
  open MAIL, |/usr/sbin/sendmail -oi -t or die sendmail : $!\n;
  print MAIL EOF;
  To: $email

Yep, using -t is an alternative.  In some cases I prefer my method, 
especially if I am sending messages to a mailing list, since I can manipulate 
the header addresses separately from the envelope address.

 etc.  Oh, and check the status on the close.

Yep.


-- 
Smoot Carl-Mitchell
Consultant





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




Re: Apache and HTML

2001-07-30 Thread Brett W. McCoy

On Mon, 30 Jul 2001, debashis rana (JIC) wrote:

 I made a HTML document using HTML-kit and I tidied it up with XHTML.  When I
 run that HTML in Apache in Windows ME I got many compilation errors. When I
 run the same  HTML in Internet Explorer I dont get any error. It works fine.
 I was wondering if there is anything I need to do configure Apache to accept
 HTML?

What does this have to do with Perl?  I think you need to consult the
Apache documentation at http://httpd.apache.org/docs/ before going any
further.

-- Brett


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




Re: running CGI on a stand alone machine

2001-07-30 Thread Francis Henry

Hi,

Maybe your server thinks it's a document?  Possible causes:

1. You've used the wrong extension on your script.  Some require the extension
to be '.cgi'.
2. Your script isn't in the correct cgi directory, which is usually /cgi-bin.

Hope this helps,
Francis

Prachi Shroff wrote:

 Hi,

 I have a perl script and designed a simple web page for its front
 end...but this package is running on a single machine and not connected
 to any server. when the form on the HTML page is submitted, it should run
 the perl script specified in the ACTION field of the form. Now, the problem
 is, when I submit the form it shows the code of the perl script instead of
 running the script and showing results.

 I think I am missing something..can anyone help?

 thanks,
 Prachi

 Below is the HTML code...am I missing something?

 html

 head

 meta http-equiv=Content-Type content=text/html; charset=windows-1252
 titleNew Page 1/title
 /head

 body

 form ENCTYPE=multipart/form-data method=post action=try.pl

   h1 align=centerfont color=#80 size=7The Automated Blast
 Page/font/h1
   hr
   pbr
   /p
   pnbsp;/p
   pfont size=5Please enter the file name of the query where all
 sequences are stored :/font/p
   pinput type=file name=query size=37nbsp;nbsp;nbsp;nbsp;/p
   pnbsp;/p
   pnbsp;/p
   pfont size=5Enter the list of species that you would want your
 search to
   focus :/font/p
   ptextarea rows=12 name=list cols=41/textarea/p
   pnbsp;/p
   pfont size=5Enter the path of the folder where the results are to be
   stored :/font/p
   pinput type=file name=results
 size=37nbsp;nbsp;nbsp;nbsp;nbsp;/p
   pnbsp;/p
   pinput type=submit value=Submit name=submitnbsp;nbsp;nbsp;
 input type=reset value=Reset name=reset/p
 /form

 /body

 /html

 _
 Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

 --
 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: String replace in a file

2001-07-30 Thread John Edwards

$lookfor = string;
$replacewith = newstring;

open IN, input.txt or die Can't open input.txt: $!;
open OUT, output.txt or die Can't create output.txt;

while (IN) {
s/$lookfor/$replacewith/ig;
print OUT;
}

close OUT;
close IN;

output.txt should now have all instances of $lookfor replaced with
$replcaewith.

Note, it's case insensitive, if you don't want that, remove the g from
s/$lookfor/$replacewith/ig;

HTH

John

-Original Message-
From: alex stan [mailto:[EMAIL PROTECTED]]
Sent: 30 July 2001 15:17
To: [EMAIL PROTECTED]
Subject: String replace in a file


Could anyone help me?
How can i find a string in a file and then replace it with another string?
Thanks a lot





---
ROL!RO free mail - http://mail.rol.ro
Spatiu nelimitat pentru contul tau si acces gratuit prin dial-up!


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


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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




Re: String replace in a file

2001-07-30 Thread Chris Milligan




 Note, it's case insensitive, if you don't want that, remove the g from
 s/$lookfor/$replacewith/ig;

If you want it case sensitive, remove the i not the g.  The i designates
ignore case. :-)

--
Life would be so much easier if we could just look at the source code.



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




Re: ref problems

2001-07-30 Thread Brett W. McCoy

On Mon, 30 Jul 2001, Mooney Christophe-CMOONEY1 wrote:

 Saying
   $a_dog-{'speak'}($a_dog)
 on the last line would solve this problem, but it would be nice not to have
 to worry about passing itself to the function.  Does anyone see any
 alternatives to this?

 Thanks!

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

 package dog;
 sub new
 {
   my $class=shift;
   my %this=@_;
   $this{'speak'}=\bark;
   bless \%this;
 }

 sub bark
 {
   my $this=shift;
   $this || die foo: it's undefined!\n;
   print $this-{'name'} says woof!\n;
 }

 package main;

 my $a_dog=dog-new(name = 'bart');
 $a_dog-{'speak'}();

My question is: why are you creating a code reference to a method that is
in the same package?  Since bark is already part of the blessed class
($this is passed in implicitly as the first argument), why are you storing
this method in the class's hash?  You aren't calling the coderef as a
method to your class, so it has no idea what the class is, which is why
you need to explicitly give it the object's reference.

-- Brett



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




Destroying Database Handle

2001-07-30 Thread Frank Newland

Question about DBI

I'm having success in preparing , executing and getting SQL output when I
use DBI.
What I want to do is ensure that I close properly. 
Q: What statement(s) do I need to prevent destroying database handle?

Thanks,

Frank
***
#!/usr/bin/perl -w 
use strict ;
use DBI;
my $dbh ; my $sth ; my $sql_stmt ; $data_row; 

$dbh = DBI-connect(dbi:Oracle:oracle:qa_1,user, password,{PrintError =0,
AutoCommit =0 )) || die failed to login to Oracle \n;
$sql_stmt =  EOF+ ;
select comments from table_a where comments is not null
EOF+ 

$sth=$dbh-prepare($sql_stmt) || die Failure to prepare SQL Statement \n ;
$sth-execute || die Failure to execute SQL \n;
$data_row=$sth-fetchrow_hashref;
$comments = $data_row-{COMMENTS};

print $comments ;
**
Output:
185221202202110  ## desired output. .
Database handle destroyed without explicit disconnect.

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




RE: eval and Data::Dumper

2001-07-30 Thread Bob Showalter

 -Original Message-
 From: mark crowe (JIC) [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, July 30, 2001 11:25 AM
 To: beginners
 Subject: eval and Data::Dumper
 
 
 Please can someone give me some advice about Data::Dumper. I 
 have a program which will generate a large multidimensional 
 array which I then want to import into another program. From 
 what I remember from some posts a while ago (and can't find 
 again now) I should be able to do this using Data::Dumper, 
 and the Camel book and perldoc seem to agree. It's just I 
 can't work out how to read the data back in. I've tried eval 
 and do, and neither of them are working as I hoped. Here's 
 some test code I've tried:
 
   use Data::Dumper;
   @array = qw(one two three);
   $string  = Dumper(@array);
   @newarray = eval $string;
   print @newarray;
 
 This outputs:
   $VAR1 = 'one';
   $VAR2 = 'two';
   $VAR3 = 'three';
   three
 
 I can print the Dumper output to a file and read it back in 
 with do or eval and get the same problem, just getting the 
 last value put into the array. Can someone point me in the 
 right direction please?

Suggestions:

1. Pass reference to your array to Dumper(): 

   $string = Dumper(\@array);

2. Read Data::Dumper docs and look at Purity and Deepcopy options. 

3. Look at Storable module.

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




RE: most efficient way to count lines in a file

2001-07-30 Thread Bob Showalter

 -Original Message-
 From: ERIC Lawson - x52010 [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, July 30, 2001 11:35 AM
 To: [EMAIL PROTECTED]
 Subject: most efficient way to count lines in a file
 
 
 What's the most efficient way to find the total number of 
 lines in a file using perl?
 
 Now, I'm using 
 
 while (FILE) { ++$lincnt; }

That's OK. This also works:

   perl -ne 'END { print $.\n }' foo

$. is line number (see perldoc perlvar)

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




RE: Destroying Database Handle

2001-07-30 Thread Bob Showalter

 -Original Message-
 From: Frank Newland [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, July 30, 2001 11:35 AM
 To: [EMAIL PROTECTED]
 Subject: Destroying Database Handle
 
 
 Question about DBI
 
 I'm having success in preparing , executing and getting SQL 
 output when I use DBI. What I want to do is ensure that I 
 close properly. 
 Q: What statement(s) do I need to prevent destroying database handle?
 
 Thanks,
 
 Frank
 ***
 #!/usr/bin/perl -w 
 use strict ;
 use DBI;
 my $dbh ; my $sth ; my $sql_stmt ; $data_row; 
 
 $dbh = DBI-connect(dbi:Oracle:oracle:qa_1,user, 
 password,{PrintError =0, AutoCommit =0 )) || die failed to 
 login to Oracle \n; $sql_stmt =  EOF+ ; select comments 
 from table_a where comments is not null
 EOF+ 
 
 $sth=$dbh-prepare($sql_stmt) || die Failure to prepare SQL 
 Statement \n ; $sth-execute || die Failure to execute SQL 
 \n; $data_row=$sth-fetchrow_hashref; $comments = 
 $data_row-{COMMENTS};
 
 print $comments ;
 **
 Output:
 185221202202110  ## desired output. .
 Database handle destroyed without explicit disconnect.

You need to use

   $sth-finish;
   $dbh-disconnect;

After you are done reading fetching the data. That should do the trick.

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




Re: most efficient way to count lines in a file

2001-07-30 Thread Peter Scott

At 08:35 AM 7/30/2001 -0700, ERIC Lawson - x52010 wrote:
What's the most efficient way to find the total number of lines in a file
using perl?

Type

 perldoc -q lines
Peter Scott
[EMAIL PROTECTED]
http://www.perldebugged.com


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




RE: Destroying Database Handle

2001-07-30 Thread mark crowe (JIC)

Try $dbh - disconnect;

Cheers

Mark C

 -Original Message-
 From: Frank Newland [mailto:[EMAIL PROTECTED]]
 Sent: 30 July 2001 16:35
 To: [EMAIL PROTECTED]
 Subject: Destroying Database Handle
 
 
 Question about DBI
 
 I'm having success in preparing , executing and getting SQL 
 output when I
 use DBI.
 What I want to do is ensure that I close properly. 
 Q: What statement(s) do I need to prevent destroying database handle?
 
 Thanks,
 
 Frank
 ***
 #!/usr/bin/perl -w 
 use strict ;
 use DBI;
 my $dbh ; my $sth ; my $sql_stmt ; $data_row; 
 
 $dbh = DBI-connect(dbi:Oracle:oracle:qa_1,user, 
 password,{PrintError =0,
 AutoCommit =0 )) || die failed to login to Oracle \n;
 $sql_stmt =  EOF+ ;
 select comments from table_a where comments is not null
 EOF+ 
 
 $sth=$dbh-prepare($sql_stmt) || die Failure to prepare SQL 
 Statement \n ;
 $sth-execute || die Failure to execute SQL \n;
 $data_row=$sth-fetchrow_hashref;
 $comments = $data_row-{COMMENTS};
 
 print $comments ;
 **
 Output:
 185221202202110  ## desired output. .
 Database handle destroyed without explicit disconnect.
 
 -- 
 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: sending mail (learning perl program)

2001-07-30 Thread Stephen P. Potter

Lightning flashed, thunder crashed and Peter Scott [EMAIL PROTECTED] whispered:
| Yes, but if you create the above using something like
| 
|  open (MAIL, |/usr/sbin/sendmail $email)
| 
| to which you should by the way add
| 
|  or die sendmail: $!\n;

This probably does not do what you think it does.  It is almost always
worthless to check the status of a pipe.  The only time the pipe will fail
is if the system fails to fork a new process.  This only happens when the
system is in very bad shape.

Many people think this will die if sendmail fails (if it isn't in
/usr/sbin, for example).  This is not true though.  Only by checking the
status of the close will you be able to determine this.

-spp
--
Stephen P Potter [EMAIL PROTECTED]
You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point.-Simon Cozens
UNIX, Perl, PHP, Web Consulting and Training  http://www.unixlabs.net/~spp/


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




arrays

2001-07-30 Thread Matija Papec


Program below works fine but I wander how to optimize this; it looks very
ugly. The final result have to be @data which contains two arrays. First
array have to be equal size of second array(@datumi2) and all their values
have to be .

--
my $i;
my (@datumi2) = (1..100);
my (@temp, @data);

# block for optimization

for $i (0..$#datumi2) { push @temp,  }
push @data, \@temp;
undef @temp;

# end of block for optimization

push @data, \@datumi2;
.
.
.


-- 
Matija

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




Re: Matching within the LHS of a regex...

2001-07-30 Thread Jeff 'japhy/Marillion' Pinyan

On Jul 30, David Wood said:

$str = qq(
udb:person
  data_onesome data/data_one
  data_twosome more data/data_two
/udb:person
);

What I need to do is something like:-

$str =~ s/udb:[^]+\n(.*?)\/udb:$1/$sub-($1,$2)/gs;

Even if you change the $1 to a \1, it won't match, since you have

  udb:[^]+\n

when you need

  udb:[^]+\n

-- 
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: counting files of a directory

2001-07-30 Thread Stephen P. Potter

Lightning flashed, thunder crashed and Sascha Kersken [EMAIL PROTECTED] w
hispered:
|   DIR = opendir (path/to/dir);

I think you mean 'opendir(DIR, /path/to/dir);' not 
'DIR = opendir(/path/to/dir);'.

-spp
--
Stephen P Potter [EMAIL PROTECTED]
You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point.-Simon Cozens
UNIX, Perl, PHP, Web Consulting and Training  http://www.unixlabs.net/~spp/

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




RE: arrays

2001-07-30 Thread John Edwards

Can you explain what your trying to achieve??

You want an array called @data which consists of all the elements from
@dataumi2? Where does the second array with empty element values come from,
why is it needed?

to assign @data with all the elements from @dataumi2 do this

@data = @dataumi2;

-Original Message-
From: Matija Papec [mailto:[EMAIL PROTECTED]]
Sent: 30 July 2001 17:06
To: [EMAIL PROTECTED]
Subject: arrays



Program below works fine but I wander how to optimize this; it looks very
ugly. The final result have to be @data which contains two arrays. First
array have to be equal size of second array(@datumi2) and all their values
have to be .

--
my $i;
my (@datumi2) = (1..100);
my (@temp, @data);

# block for optimization

for $i (0..$#datumi2) { push @temp,  }
push @data, \@temp;
undef @temp;

# end of block for optimization

push @data, \@datumi2;
.
.
.


-- 
Matija

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


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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




Re: arrays

2001-07-30 Thread Jeff 'japhy/Marillion' Pinyan

On Jul 30, Matija Papec said:

my $i;
my (@datumi2) = (1..100);
my (@temp, @data);

# block for optimization

for $i (0..$#datumi2) { push @temp,  }
push @data, \@temp;
undef @temp;

# end of block for optimization

push @data, \@datumi2;

You can use the length of an array with the x (repetition) operator, and
get a nifty thing like:

  @array = ( 1 .. 100 );
  @blanks = () x @array;

Now @blanks is 100 elements of .

Oh, you have a problem with your code:

  $x = \@foo;
  undef @foo;

That kills the underlying array that $x refers to.  You'd need to do

  $x = [ @foo ];
  undef @foo;

But that's not needed to do what you want:

  @data = (
[ () x @datumi2 ],
\@datumi2,
  );

-- 
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: String replace in a file

2001-07-30 Thread Stephen P. Potter

Lightning flashed, thunder crashed and alex stan [EMAIL PROTECTED] whispered:
| Could anyone help me?
| How can i find a string in a file and then replace it with another string?
| Thanks a lot

Try:

perl -i.bak -pe 's/oldstring/newstring/g' filename

This will create a backup of the original file and a new file with the
changes.

-spp
--
Stephen P Potter [EMAIL PROTECTED]
You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point.-Simon Cozens
UNIX, Perl, PHP, Web Consulting and Training  http://www.unixlabs.net/~spp/


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




Re: arrays

2001-07-30 Thread Troy Denkinger

On Monday 30 July 2001 12:05, Matija Papec wrote:
 Program below works fine but I wander how to optimize this; it looks very
 ugly. The final result have to be @data which contains two arrays. First
 array have to be equal size of second array(@datumi2) and all their values
 have to be .

Hmmm, this isn't working for me - at least not the way you describe it.  What 
I see you saying is that you want an array (@data) to contain references to 
two other arrays.  Each of the arrays referred two must have the same number 
of elements; in one array you'll have numbers ( 1..100 in your example ) and 
the other containing the same number of elements all of which are equal to 
.  

When I run your program with Data::Dumper, I get the following (I'm only 
doing a few elements for this illustration):

$VAR1 = [
  [],
  [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10
  ]
];

which indicates that the first array is empty.  The problem is the undef of 
@temp.  What you've put into @array is a reference to @temp.  When you undef 
it, you're undefing the array that the reference in array points to.

In any event, I can't figure out why you'd want to do what I think it is 
you're trying to do. There certainly may be a vaild reason for it, but there 
may be a better solution.

Can you say what it is you're trying to accomplish?

Regards,

Troy Denkinger





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




search for string in a file

2001-07-30 Thread alex stan

I need to search for a string in httpd.conf file , ( the string is :
CustomLog /var/log/httpd/site.com/access_log ) and then replace
inside them  site.com with site_com. I mentioned that the site.com can take
diferent values, such as shop.com , 
 radioq.com
 etc.
Could you help me?
Thanks a lot






---
ROL!RO free mail - http://mail.rol.ro
Spatiu nelimitat pentru contul tau si acces gratuit prin dial-up!


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




Re: copying file

2001-07-30 Thread Brad

File::Copy does the opening/closing of files for you.  You might be messing
things up by doing an open/close around the copy operation (though I can't
see why myself).  Try just:
--
#!/usr/bin/perl -w
use strict;
use File::Copy;
copy(temp.htm, lmi/aol.htm);
--

I tried this code quickly on my (linux) system and it seemed to work.  It
should also work on win32 if that's what you're using (seeing as you're
trying to copy .htm files).

If it doesn't work, hopefully the addition of use strict will give you a
clue.  If not, since you've already opened the files you could just
while(TEMP){print FICHIER}   (won't necessarily work for binary files.)

-- Brad

 Hi!

 I want to copy temp.htm to aol.htm
 Why doesn't this code work ?

 #!/usr/bin/perl -w
 open(TEMP, +temp.htm);
 open(FICHIER,lmi/aol.htm);
 use File::Copy;
 copy(temp.htm,lmi/aol.htm) ;
 close FICHIER;
 close TEMP;


 Thanks

 Franck

 --
 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]




Perl and Date Handling

2001-07-30 Thread David Simcik

Hey folks,
I'm about to embark on some serious beginner date manipulation and I was
wondering if anybody had ANY pointers about handling dates. I'm specifically
interested in working with the different date formats DD/MM/,
MM/DD/, Dec 12 2000, etc. etc. What about working with the DATE datatype
for Oracle and MySQL via DBI???

THANKS!
DTS


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




RE: ref problems

2001-07-30 Thread Mooney Christophe-CMOONEY1

Yes -- i see now that i'm going about this whole thing the wrong way.  I'm
trying to make the module do too much.  It's a bad habit i'm trying to
break.

I suppose if the luser who uses my package doesn't like what 'bark' does
s/he will just have to overload it themselves.  ;)

Interestingly enough i took a class last year where we each wrote a massive
program in C++.  I kept asking the professor how to tell what one object
should do and what it should leave for another one to do.  He never really
gave me a straight answer, but he would always get on my case for trying to
make my modules god-like.

I guess it's just an art--one i have yet to master.  ;)

-Original Message-
From: Jos I. Boumans [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 30, 2001 10:14 AM
To: Mooney Christophe-CMOONEY1; [EMAIL PROTECTED]
Subject: Re: ref problems


Hi,

I'm not sure you're quite understanding the logic of modules and packages
yet...
the idea of a module is that you use methods (subroutines belonging to a
package) to execute code
however, you're making your 'methods' attributes to an object.
This quite defeats the purpose and provides nothing in the form of
encapsulation.
(concider some ev0l subroutine you pass your object to says:
sub foo {
my $self  = shift;
$self-{'speak'} = undef;
}

That would cause serious dying of your script when calling the 'method'

Maybe you should raed up on modules a bit first and OO programming in
general

I wrote a tutorial on http://japh.nu that you might find very interesting,
since it deals with jsut these things
also, the following perldocs are very usefull
perlboot
perltoot
perltootc

hth,

Jos Boumans



 Hello, all -- i have come across an interesting problem.  When i run the
 following script, i get that '$this' in dog::bark is undefined.  When i
 think about it, this makes sense, since call $a_dog-{'speak'}() is like
 saying dog::bark.

 Saying
 $a_dog-{'speak'}($a_dog)
 on the last line would solve this problem, but it would be nice not to
have
 to worry about passing itself to the function.  Does anyone see any
 alternatives to this?

 Thanks!

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

 package dog;
 sub new
 {
 my $class=shift;
 my %this=@_;
 $this{'speak'}=\bark;
 bless \%this;
 }

 sub bark
 {
 my $this=shift;
 $this || die foo: it's undefined!\n;
 print $this-{'name'} says woof!\n;
 }

 package main;

 my $a_dog=dog-new(name = 'bart');
 $a_dog-{'speak'}();
 


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




modules question

2001-07-30 Thread anna . roberts

Dose anyone know of a exsiting Perl module that will test to see what tape drives are 
available on Unix box?

I looked through the some of the CPAN stuff but didn't find anything that looked like 
what I might need.  

Any help would be appreciated. 

Thank you,

Anna

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




Deleting Duplicate Lines one-liner

2001-07-30 Thread David Blevins

Here is a one-liner I just wrote to delete duplicate lines in a file.

perl -ni.bak -e 'unless ($last eq $_){print $_};$last=$_;' theFile

Going with the TMTOWTDI credo, I was just curious if anyone knew of a better
way.

Thanks,
David


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




is there a module ala getopt::long that will ... as well as command-line completion

2001-07-30 Thread Matt Lyon

here's one for the group... is there a module ala getopt::long that will do
the arg-getting as well as command-line completion with a predefined
list/hash/etc... of keywords?

-mL
-- Life would be so much easier if its source code was well-commented.


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




Re: Deleting Duplicate Lines one-liner

2001-07-30 Thread Paul


--- David Blevins [EMAIL PROTECTED] wrote:
 Here is a one-liner I just wrote to delete duplicate lines in a file.
 
 perl -ni.bak -e 'unless ($last eq $_){print $_};$last=$_;' theFile

That requires that it be sorted, doesn't it?

 Going with the TMTOWTDI credo, I was just curious if anyone knew of a
 better way.

For *S*M*A*L*L* files, I use a hash.

 perl -ni.bak -e 'unless ($hit{$_}){$hit{$_}++,print $_}' theFile

That preserves the order of nonduplicated lines, but eats a lot of
memory if the file is very big at all. 

If you don't want to preserve the order, try sort -u theFile 
( though that isn't Perl =o)



__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




reference to a two dimensional array

2001-07-30 Thread Robb Wagoner

I have a two dimensional array where each element consists of a reference to
an anonymous array.

push(@array,[$var1,$var2,$var3]);

When I pass a reference to the array in a subroutine:

some_sub(\@array);

What is the proper way to dereference the array with in the subroutine?

After much monkeying I was able to get this to work:

@{$_}-[0][0]


Is there a better, more readable way to do this?

Thanks.
-Robb


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




Re: Deleting Duplicate Lines one-liner

2001-07-30 Thread Carl Rogers

One word of caution it looks to me like this will catch duplicates 
lines, just as long as the duplicate lines follow each other. You may want 
to do some kind of a sort process prior to running this line of code.
Only reason I bring this up... I've been bitten by this same problem in the 
past:)
I've used rpsort (I think it's freeware/shareware) to sort an entire line 
(not exactly efficient for larger files, but it seems to do the trick),
I also got some help from someone on this list who provided the following 
(this didn't require a sort process prior to running it)

while (INPUTFILE){
   if (not $seen{$_}) {
   $seen{$_} = 1;
print OUTFILE;
}
else {
}
  }

I wish I could tell you why/how it works (I'm *still* working my way up to 
newbie status), but it does. (Magic??)..  It'll take longer for big files, 
but again, it does the trick.

HTH
Carl

At 12:30 PM 7/30/2001 -0500, David Blevins wrote:
Here is a one-liner I just wrote to delete duplicate lines in a file.

perl -ni.bak -e 'unless ($last eq $_){print $_};$last=$_;' theFile

Going with the TMTOWTDI credo, I was just curious if anyone knew of a better
way.

Thanks,
David


--
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: reference to a two dimensional array

2001-07-30 Thread Jeff 'japhy/Marillion' Pinyan

On Jul 30, Robb Wagoner said:

When I pass a reference to the array in a subroutine:

   some_sub(\@array);

What is the proper way to dereference the array with in the subroutine?

I do:

  some_sub([ [1,2,3], [4,5,6] ]);

  sub some_sub {
my $aref = shift;
print $aref-[0][0];  # 1
print $aref-[1][2];  # 6
  }

I suggest you read

  perldoc perlreftut
  perldoc perlref
  perldoc perllol
  perldoc perldsc

Not all *MUST* be read, but the last two are definitely helpful for coming
up with ways of dealing with your structures once you've made them.  The
first two are definitely a good starting place, though.

I also have some documentation I wrote up:

  http://www.pobox.com/~japhy/docs/using_refs

-- 
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]




search for string in a file

2001-07-30 Thread alex stan

I need to search for a string in httpd.conf file , ( the string is :
CustomLog /var/log/httpd/site.com/access_log ) and then replace
inside them  site.com with site_com. I mentioned that the site.com can take
diferent values, such as shop.com , 
 radioq.com
 etc.
Could you help me?
Thanks a lot












---
ROL!RO free mail - http://mail.rol.ro
Spatiu nelimitat pentru contul tau si acces gratuit prin dial-up!


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




Re: reference to a two dimensional array

2001-07-30 Thread Brett W. McCoy

On Mon, 30 Jul 2001, Robb Wagoner wrote:

 I have a two dimensional array where each element consists of a reference to
 an anonymous array.

   push(@array,[$var1,$var2,$var3]);

 When I pass a reference to the array in a subroutine:

   some_sub(\@array);

 What is the proper way to dereference the array with in the subroutine?

 After much monkeying I was able to get this to work:

   @{$_}-[0][0]

No need to monkey around, this is well documented in the perlref POD.

some_sub(\@array);

sub some_sub {

  my $arr = shift;

  my $var = $arr-[0][0];

  # etc etc etc
}

-- Brett

Brett W. McCoy
Software Engineer
Broadsoft, Inc.
240-364-5225
[EMAIL PROTECTED]


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




Re: arrays

2001-07-30 Thread Matija Papec

John Edwards [EMAIL PROTECTED] wrote:
Can you explain what your trying to achieve??

You want an array called @data which consists of all the elements from
@dataumi2? Where does the second array with empty element values come from,
why is it needed?

ok, to simplify let's suppose that

@datumi2 = (1, 2, 3);

#so final result should look like this:
@data[0] = (, , );
#and
@data[1] = (1, 2, 3);

I want to make @data[0] on the fly without for structure and it should
have the same number of elements as @datumi2.

This may look somehow silly but I'm working with GD::Graph module and want
to avoid X values being drawn, so there is a need for array where all
elements are .


-- 
Matija

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




RE: reference to a two dimensional array

2001-07-30 Thread Robb Wagoner

That's what I thought but I couldn't seem to get it to work. I am going to
go try it again. I am betting I had a typo somewhere when I what seemed to
be the proper way. 
I DO read the warnings and errors and look at what line number the parser
pukes on. . .

Thanks Brett.

Robb



-Original Message-
From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 30, 2001 10:59 AM
To: Robb Wagoner
Cc: [EMAIL PROTECTED]
Subject: Re: reference to a two dimensional array


On Mon, 30 Jul 2001, Robb Wagoner wrote:

 I have a two dimensional array where each element consists of a reference
to
 an anonymous array.

   push(@array,[$var1,$var2,$var3]);

 When I pass a reference to the array in a subroutine:

   some_sub(\@array);

 What is the proper way to dereference the array with in the subroutine?

 After much monkeying I was able to get this to work:

   @{$_}-[0][0]

No need to monkey around, this is well documented in the perlref POD.

some_sub(\@array);

sub some_sub {

  my $arr = shift;

  my $var = $arr-[0][0];

  # etc etc etc
}

-- Brett

Brett W. McCoy
Software Engineer
Broadsoft, Inc.
240-364-5225
[EMAIL PROTECTED]

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




Re: ideas...?

2001-07-30 Thread Michael Fowler

On Sun, Jul 29, 2001 at 09:10:03AM -0400, bc wrote:
 couldn't find diagnostic data in
 /usr/local/lib/perl5/5.6.0/pods/perldiag.pod
 /usr/local/lib/perl5/5.6.0/i686-linux /usr/local/lib/perl5/5.6.0
 /usr/local/lib/perl5/site_perl/5.6.0/i686-linux
 /usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl .
 csvtest.pl at /usr/local/lib/perl5/5.6.0/diagnostics.pm line 241,
 POD_DIAG line 549.

It would appear diagnostics.pm couldn't find perldiag.pod.  Search your Perl
library directories for that file.  If it's not there then your Perl
installation didn't include full documentation; if it is there then the POD
is in a place perl doesn't know about.

Either way you have a broken Perl installation.  If you installed it from a
package you should complain to the packager, and look for a new and/or
better version.  If you installed it yourself you must have missed some
things.


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: arrays

2001-07-30 Thread Michael Fowler

On Mon, Jul 30, 2001 at 08:02:58PM +0200, Matija Papec wrote:
 ok, to simplify let's suppose that
 
 @datumi2 = (1, 2, 3);
 
 #so final result should look like this:
 @data[0] = (, , );
 #and
 @data[1] = (1, 2, 3);

This notation is almost certainly incorrect, what you probably meant to say
is:

$data[0] = [, , ];
$data[1] = [ 1,  2,  3];

or
@{ $data[0] } = (, , );
@{ $data[1] } = ( 1,  2,  3);


The assignments you showed will result in:

$data[0] = ;
$data[1] =  3;

along with various warnings.


 I want to make @data[0] on the fly without for structure and it should
 have the same number of elements as @datumi2.

Your restriction that it not use a for loop to construct the data is
needlessly limiting.  There are several ways to do what you ask, one of them
is a for loop.

push(@{ $data[0] }, ) for (0 .. $#datumi2);

OR

push(@{ $data[0] }, ) for @dataumi2;

OR

$data[0] = [() x @datumi2];


Each has strengths and weaknesses.


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: Getopts and ARGV

2001-07-30 Thread Paul


--- Bob Bondi [EMAIL PROTECTED] wrote:
 I had wanted to keep all the declarations in a section and the subs
 in a section and the main script at the bottom, but, I find I must
add
 code in the declaration section!

I like to keep sections too, though the parser doesn't care so much.
Try this:

BEGIN { 
  die Not enough arguments to get started\n -h for help\n
  unless @ARGV;;
  die__END if grep /^-h/, @ARGV; # simpler, more forgiving

 This is the help message stuff as a here document.
 (It's also great for documentation,
  since it's here at the top of the code,
  and readably set off to itself!)

__END
}

That sets it off as significant, and runs it before bothering to load a
bunch of other modules and pragmas that you won't need if the program
was just run for help. You can out some of the use() statements above
it if you like ( such as Carp =o)  but this lets you keep them all
together if you prefer.


__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




Re: search for string in a file

2001-07-30 Thread Peter Scott

Oops, slight mistake:

At 12:39 PM 7/30/01 -0700, Peter Scott wrote:
At 08:57 PM 7/30/01 +0300, alex stan wrote:
I need to search for a string in httpd.conf file , ( the string is :
CustomLog /var/log/httpd/site.com/access_log ) and then replace
inside them  site.com with site_com. I mentioned that the site.com can take
diferent values, such as shop.com ,
  radioq.com
  etc.
Could you help me?
Thanks a lot

Assuming that you want to replace dots with underscores in whatever 
appears between slashes in such a line:

Clarification: between the pair of slashes between 'httpd' and 'access_log'.

open LOG, httpd.conf or die Can't open httpd.conf: $!\n;
while (LOG) {
 if (!^CustomLog /var/log/httpd/([^/]+)/access_log!) {

Should say if (m!^CustomLog ... (rest the same)

 my ($site = $1) =~ tr/./_/;
 s!httpd/[^/]+/!httpd/$site/!;
 }
 print;
}
close LOG;

Of course it can be done in one go but considering my recent comment about 
being too clever...
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


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




Re: sending mail (learning perl program)

2001-07-30 Thread smoot

 Stephen P. Potter [EMAIL PROTECTED] said:

 | 
 |  open (MAIL, |/usr/sbin/sendmail $email)
 | 
 | to which you should by the way add
 | 
 |  or die sendmail: $!\n;
 
 This probably does not do what you think it does.  It is almost always
 worthless to check the status of a pipe.  The only time the pipe will fail

Not quite.  If sendmail is not executable or misspelled, the die will return 
an error message.  Try:

open(IN, |/usr/sbin/sendmial) || die cannot run sendmail - $!\n;

This returns the error:

cannot run sendmail - no such file or directory

-- 
Smoot Carl-Mitchell
Consultant





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




Re: [OT?]Deleting Duplicate Lines one-liner

2001-07-30 Thread Casey West

On Mon, Jul 30, 2001 at 02:16:42PM -0600, Canavan, John wrote:
: Hopefully, at least some beginners would find this playful and entertaining
: enough that they'd be willing to work a little harder to understand the
: code.  When I'm learning a new language, I enjoy reading playful but hard
: code some of the time.

Yes, I imagine it would be a fun thing for beginners to see.  Some
might try hard to understand them.  A teaser would be fine but, the
entirety of a one-liner thread most likley doesn't belong on the
beginners lists[*].  Not to mention, Fun With Perl is so low traffic
that if they are interested they can surely sign up.

* If someone is asking a question about How to X in a one-liner,
  it's probably ok here, to a point.  That point gets pushed further
  and further away the more usefull and real (for some value of real)
  the one-liner is.

  Casey West

-- 
Shooting yourself in the foot with dBase 
You buy a gun. Bullets are only available from another company and are
promised to work so you buy them. Then you find out that the next
version of the gun is the one scheduled to actually shoot bullets. 

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




find2perl

2001-07-30 Thread Greg Tomczyk

Hello,

I am new to this list and hope someone, will be able to help me. I am
trying to do a find/search on a directory tree and store the results of
that find into an array which I can then manipulate. I can run find using
the system command an put contents into a flat file, but I would like to
understand this find2perl routing. I know find pretty well, but the
documentation on find2perl is confusing to me. Can anyone help..

Here is the Unix find command:

find $dir -local -exec grep -q $string {} |;


and I would like some sort of perl equivalent which would allow the results
of this find to placed in @filelist...

Anyone have any ideas? maybe find2perl is not the answer; I do not know..


thanks
Greg

--
Gregory D. Tomczyk
IBM - Contractor
(503) 578-5390
[EMAIL PROTECTED]


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




Re: find2perl

2001-07-30 Thread Brett W. McCoy

On Mon, 30 Jul 2001, Greg Tomczyk wrote:

 I am new to this list and hope someone, will be able to help me. I am
 trying to do a find/search on a directory tree and store the results of
 that find into an array which I can then manipulate. I can run find using
 the system command an put contents into a flat file, but I would like to
 understand this find2perl routing. I know find pretty well, but the
 documentation on find2perl is confusing to me. Can anyone help..

 Here is the Unix find command:

 find $dir -local -exec grep -q $string {} |;


 and I would like some sort of perl equivalent which would allow the results
 of this find to placed in @filelist...

Have you looked at the File::Find module?

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

Al didn't smile for forty years.  You've got to admire a man like that.
-- from Mary Hartman, Mary Hartman


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




Re: sending mail (learning perl program)

2001-07-30 Thread Mel Matsuoka

At 01:39 PM 07/30/2001 -0700, [EMAIL PROTECTED] wrote:
 Stephen P. Potter [EMAIL PROTECTED] said:

 | 
 |  open (MAIL, |/usr/sbin/sendmail $email)
 | 
 | to which you should by the way add
 | 
 |  or die sendmail: $!\n;
 
 This probably does not do what you think it does.  It is almost always
 worthless to check the status of a pipe.  The only time the pipe will fail

Not to mention the fact that that open() call is a bigass security
vulnerability waiting to be exploited. What if the user-supplied value of
$email was something like ;rm -rf .  ? Not good.

You should really be using sendmail with the -t flag to avoid shell
exploits like this. 

Aloha,
mel
--
mel matsuoka  Hawaiian Image Productions
Chief Executive Alphageek(vox)1.808.531.5474
[EMAIL PROTECTED](fax)1.808.526.4040
 

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




Re: [OT?]Deleting Duplicate Lines one-liner

2001-07-30 Thread Paul


--- Casey West [EMAIL PROTECTED] wrote:
 Yes, I imagine it would be a fun thing for beginners to see.  Some
 might try hard to understand them.  A teaser would be fine but, the
 entirety of a one-liner thread most likley doesn't belong on the
 beginners lists[*].  Not to mention, Fun With Perl is so low traffic
 that if they are interested they can surely sign up.

1) Is that a let's drop this thread request?
   While *I* am having a ball with it, I'd rather not stress the
   Nu-B's...

2) Since we mention it (and it realy does sound like fun to me), where
exactly does one subscripbe to this Fun With Perl list? {:^)

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




Re: [OT?]Deleting Duplicate Lines one-liner

2001-07-30 Thread Casey West

On Mon, Jul 30, 2001 at 02:19:00PM -0700, Paul wrote:
: 
: --- Casey West [EMAIL PROTECTED] wrote:
:  Yes, I imagine it would be a fun thing for beginners to see.  Some
:  might try hard to understand them.  A teaser would be fine but, the
:  entirety of a one-liner thread most likley doesn't belong on the
:  beginners lists[*].  Not to mention, Fun With Perl is so low traffic
:  that if they are interested they can surely sign up.
: 
: 1) Is that a let's drop this thread request?
:While *I* am having a ball with it, I'd rather not stress the
:Nu-B's...

I suppose it is, yes.

: 2) Since we mention it (and it realy does sound like fun to me), where
: exactly does one subscripbe to this Fun With Perl list? {:^)

Subscribe at [EMAIL PROTECTED]

  Casey West

-- 
Those parts of the system that you can hit with a hammer (not advised)
are called hardware; those program instructions that you can only
curse at are called software. 

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




Re: [OT?]Deleting Duplicate Lines one-liner

2001-07-30 Thread Casey West

On Mon, Jul 30, 2001 at 04:40:56PM -0400, Casey West wrote:
: On Mon, Jul 30, 2001 at 02:19:00PM -0700, Paul wrote:
: : 
: : --- Casey West [EMAIL PROTECTED] wrote:
: :  Yes, I imagine it would be a fun thing for beginners to see.  Some
: :  might try hard to understand them.  A teaser would be fine but, the
: :  entirety of a one-liner thread most likley doesn't belong on the
: :  beginners lists[*].  Not to mention, Fun With Perl is so low traffic
: :  that if they are interested they can surely sign up.
: : 
: : 1) Is that a let's drop this thread request?
: :While *I* am having a ball with it, I'd rather not stress the
: :Nu-B's...
: 
: I suppose it is, yes.

I should clarify.  If this thread can continue with cool examples
*and* good explinations, there is no reason why it should be removed.
People will learn something from it.  If those requirements can't be
met then, it probably won't be a very usefull thread.  On FWP you
don't have to explain.  Pick your poison.  :-)

  Casey West

-- 
The most likely way for the world to be destroyed, most experts agree,
is by accident. That's where we come in; we're computer
professionals. We cause accidents. 
 -- Nathaniel Borenstein

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




Re: sending mail (learning perl program)

2001-07-30 Thread Peter Scott

At 10:56 AM 7/30/01 +, Mel Matsuoka wrote:
At 01:39 PM 07/30/2001 -0700, [EMAIL PROTECTED] wrote:
  Stephen P. Potter [EMAIL PROTECTED] said:
 
  |
  |  open (MAIL, |/usr/sbin/sendmail $email)
  |
  | to which you should by the way add
  |
  |  or die sendmail: $!\n;
 
  This probably does not do what you think it does.  It is almost always
  worthless to check the status of a pipe.  The only time the pipe will fail

Not to mention the fact that that open() call is a bigass security
vulnerability waiting to be exploited. What if the user-supplied value of
$email was something like ;rm -rf .  ? Not good.

You should really be using sendmail with the -t flag to avoid shell
exploits like this.

Believe it or not, that's exactly what the rest of the message Stephen 
Potter was following up to said.

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


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




Re: find2perl

2001-07-30 Thread Michael Fowler

On Mon, Jul 30, 2001 at 01:50:55PM -0700, Greg Tomczyk wrote:
 Anyone have any ideas? maybe find2perl is not the answer; I do not know..

find2perl is exactly what you want.  It takes a command line as you'd give
it to find and converts it into Perl.  You can then take this code and use
it directly, or modify it as you see fit.


 find $dir -local -exec grep -q $string {} |;

find2perl doesn't recognized the -local option, and the last argument to
-exec should be ;, not |;.  This is how you would invoke find2perl (I'm
assuming here that -local tells your find not to cross filesystem
boundaries; my find (GNU find 4.17) has no option by that name).

find2perl / -xdev -exec grep -q string {} \;

This will generate the code that is the equivalent of the find command you
showed.  Modify it to taste.


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: sending mail (learning perl program)

2001-07-30 Thread Mike Rodgers

Doh.  I don't know how many times I looked at it and still didn't see
the word 'mail' prior to my username.
Thanks to all who responded.
Mike

Marcelo Ramos wrote:
 
 El Sun, 29 Jul 2001 10:31:11 -0500
 Mike Rodgers [EMAIL PROTECTED] escribió:
 
 On page 23 of Learning Perl, there are commands to mail a message out.
 I have tried to manually send myself a message with mail and it works.
 The program does not work.  I'm not sure why.  Here is the code:
 
 open(MAIL, mail EMAIL_ADDRESS_HERE);
 print MAIL bad news: $somename guessed $someguess\n;
 close (MAIL);
 
 
 Do you write |mail username\@localhost ?
 
 The | and \@ are necessary.
 
 Regards.
 
 --
 __
  __  _
  Marcelo Ramos  |  \/   __|
  Suse 7.1 GNU/Linux 2.2.19  |  |_//
  Linux registered user #118109  |\
  [EMAIL PROTECTED]   |_|\/|_|\_\
 
  Firma la peticion de drivers para Linux en :
  http://www.libranet.com/petition.spanish.html
 
 --
 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]




Does optimizing Perl speed up Perl programs?

2001-07-30 Thread Steve Snyder

Hello.

I am a total perl newbie who is running perl v5.6 on a RedHat Linux v7.1 
system.

I am using a perl program as a Web proxy redirector, a program that I would 
very much like to improve the performance of.  If I improve the performance 
of perl itself (by building it with different compiler switches) will this 
translate into improved runtime performance in the perl program itself?  

My (dim) understanding is that perl works as a sort of runtime compiler.  
This leave me uncertain if a faster perl build/installation will actually 
run the programs faster or simply compile them faster at startup, leaving 
the runtime performance unchanged.

Please cc me as I am not a subscriber to this list.  Thank you.

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




Re: modules question

2001-07-30 Thread Elaine -HFB- Ashton

[EMAIL PROTECTED] [[EMAIL PROTECTED]] quoth:
*Dose anyone know of a exsiting Perl module that will test to see what tape drives 
are available on Unix box?
*
*I looked through the some of the CPAN stuff but didn't find anything that looked 
like what I might need.  

None that I'm aware of as it is so gnarly across different Unixes to get
the device that you'll probably have to go with a system specific command
to list all your available drives.

e.

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