[16723] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4135 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 25 18:10:32 2000

Date: Fri, 25 Aug 2000 15:10:19 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <967241419-v9-i4135@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 25 Aug 2000     Volume: 9 Number: 4135

Today's topics:
        Searching an Array of Hashes <smerr612@mailandnews.com>
    Re: Searching an Array of Hashes <jeff@vpservices.com>
    Re: Searching an Array of Hashes <mauldin@netstorm.net>
    Re: selling perl to management (Logan Shaw)
    Re: Sorting by a subfield <lr@hpl.hp.com>
    Re: Sorting by a subfield pape_98@my-deja.com
    Re: source question <rsmith@sympatico.ca>
    Re: source question <mauldin@netstorm.net>
    Re: source question <rsmith@sympatico.ca>
    Re: Stumped by Reg Exp Problem - help?? <elephant@squirrelgroup.com>
    Re: stupid question probably (Abigail)
    Re: To push or not to push (Abigail)
    Re: uc problems (Abigail)
        uninitialized value ... getpgrp.al bob_orlando@my-deja.com
    Re: URLs ending in / <flavell@mail.cern.ch>
    Re: URLs ending in / cbdeja@my-deja.com
        what does "to spider" mean? dunno2k@my-deja.com
    Re: what does "to spider" mean? (Steve Leibel)
        What is JPL? how to use it? <info@digitaltango.com>
    Re: Where is the Perl Newbie or Begginers group? <blah@cwcom.bkak.net>
    Re: WORKIN WITH C in PERL (Abigail)
    Re: would you recommend buying a book (Abigail)
        Writing FAQs via PERL (Roger Daniel Pease)
    Re: Wrong @INC in Apache (Abigail)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 25 Aug 2000 20:00:13 GMT
From: Steven Merritt <smerr612@mailandnews.com>
Subject: Searching an Array of Hashes
Message-Id: <8o6j7v$e7t$1@nnrp1.deja.com>

I've got an array of hashes(well, hashrefs actually) and I've got
several variables I need to use to search this array and decide to fill
another array @Matches with the proper records.

Here's the sub I'm using, the @Recs array is full of hashrefs, and when
I do a print on one of those hashrefs it shows the proper data, but when
I try to compare them to my search parameters, it never fills the
matches array.

sub find_matches {

# If someone only entered a start date, we want to find only the records
# younger than that date.


if ($From_Date && !$To_Date && !$Search_Name && !$Search_Status &&
    !$Search_Applid && !$Search_Environ && !$Search_SR && !$Search_Oper
    && !$Search_Pegasys_EER && !$Keyword){
   foreach $DataLine (@Recs){
      if ($From_Date ge $DataLine->{Timestamp}){
         push @Matches, $DataLine;
       }
   }
}

#  They may have just entered a date range, so all records in that date
#  range

elsif ($From_Date && $To_Date && !$Search_Status && !$Search_Name &&
       !$Search_Applid && !$Search_Environ && !$Search_SR &&
       !$Search_Oper && !$Search_Pegasys_EER && !$Keyword){
   foreach $DataLine (@Recs){
      if (($From_Date ge $DataLine->{Timestamp}) &&
           ($To_Date le $DataLine->{Timestamp})){
         push @Matches, $DataLine;
       }
   }
}

#  They may have entered several search choices and want to find records
#  which match all of these things.

elsif ($Any_All eq 'All') {
   foreach $DataLine (@Recs){
      if ($From_Date ge $DataLine->{Timestamp}
          && $To_Date le $DataLine->{Timestamp}
          && $Search_Status eq $DataLine->{Status}
          && $DataLine->{Applid} =~ /$Search_Applid/
          && $DataLine->{Environ} =~ /$Search_Environ/
          && $DataLine->{SR} =~ /$Search_SR/
          && $DataLine->{Oper} =~ /$Search_Oper/
          && $DataLine->{Pegasys_EER} =~ /$Pegasys_EER/
          && $DataLine->{Desc} =~ /$Keyword/) {
          push @Matches, $DataLine;
         }
   }
}

#  They may have entered search terms and wanted to find records with
#  any of them.

elsif ($Any_All eq 'Any') {
  foreach $DataLine (@Recs){
      if ($From_Date ge $DataLine->{Timestamp}
          && $To_Date le $DataLine->{Timestamp} &&
             ($Search_Status eq $DataLine->{Status}
              || $DataLine->{Applid} =~ /$Search_Applid/
              || $DataLine->{Environ} =~ /$Search_Environ/
              || $DataLine->{SR} =~ /$Search_SR/
              || $DataLine->{Oper} =~ /$Search_Oper/
              || $DataLine->{Pegasys_EER} =~ /$Pegasys_EER/
              || $DataLine->{Desc} =~ /$Keyword/)
          ){
          push @Matches, $DataLine;
         }
   }
}

print @Matches; #Shows no output


}#End Sub


Here are the initializations and test values I'm using for my test
variables.  It should fail in all cases but case 2, but then it should
fill with quite a few records.

my ($Search_Status, $Search_Name, $Search_Applid, $Search_Environ,
$Search_SR, $Search_Oper, $Search_Pegasys_EER, $Keyword);
my $From_Date = '19991001091612';
my $To_Date = '20000603111734';
my $Any_All;

I'm having a bear of a time with this program because there just doesn't
seem to be much out there in the way of documentation or examples
dealing with Arrays of Hashes.  Even the Camel says that "these data
structures tend to be used less than the others."  But for this
particular project, this is the best structure for the data.  Any
insight would be welcomed.

Steven
--
King of Casual Play
The One and Only Defender of Cards That Blow

My newsreader limits sigs to four lines, but I cleverly bypassed this by


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Fri, 25 Aug 2000 13:31:42 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Searching an Array of Hashes
Message-Id: <39A6D7AE.1F39C179@vpservices.com>

Steven Merritt wrote:
> 
> I've got an array of hashes(well, hashrefs actually) and I've got
> several variables I need to use to search this array and decide to fill
> another array @Matches with the proper records.

You have made a good start at reinventing the wheel on this, but since
all of your operations are standard database operations you should
probably just use datbase access methods.  With DBD::RAM you can create
your database either from a file (in almost any format), or directly
from your array (or actually your reference to an array of hashrefs). 
You can then use SQL queries on it.  Here's a simple example, all you
need to do to make it work on your data is substitute in your array  for
the data_source, change the col_names to match your column headings, and
use any number of SQL queries (combinations of AND, OR, NOT as per your
examples):

use DBI;
my $dbh=DBI->connect('dbi:RAM:',,,{RaiseError=>1})
        or die $DBI::errstr;
$dbh->func({
    table_name  => 'test',
    col_names   => 'id,phrase',
    data_type   => 'HASH',
    data_source => [
        {id=>1,phrase=>'Hello new world!'},
        {id=>2,phrase=>'Junkity Junkity Junk'},
    ],
},'import');
print $dbh->selectrow_array(
    'SELECT phrase FROM test WHERE id = 1'
); # prints 'Hello new world!';
__END__


Jeff
-- 
perl -MDBI -e "$d=DBI->connect('dbi:RAM:');
$d->func(['Just,Another,Perl,Hacker'],'import');
print join ' ', $d->selectrow_array('SELECT * FROM table1')"


------------------------------

Date: Fri, 25 Aug 2000 20:41:32 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Searching an Array of Hashes
Message-Id: <39A6D976.D1B7D08A@netstorm.net>

Steven Merritt wrote:
> 

>       if (($From_Date ge $DataLine->{Timestamp}) &&
>            ($To_Date le $DataLine->{Timestamp})){
> 
> my $From_Date = '19991001091612';
> my $To_Date = '20000603111734';

The condition can never be true with these values of $From_Date and
$To_Date.

-- Jim


------------------------------

Date: 25 Aug 2000 16:42:32 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: selling perl to management
Message-Id: <8o6p88$g32$1@provolone.cs.utexas.edu>

In article <8o621i$ojp$1@nnrp1.deja.com>,  <reg_exp@my-deja.com> wrote:
>* perl code is about 10 times smaller than the c code
>
>i now need to make a presentation to the senior management to get them
>to accept perl. the initial response i got was:
>
>* perl is tough to read, tough to maintain
>* it's going to be tough getting people to maintain perl code and tough
>to train people in perl.

I think first of all you want to establish in a concrete way why Perl
is better for the job.  The fact that the code is 10 times shorter in
perl is a very important point.  More lines of code generally means
more work to maintain.  You might even try to take a real world example
and show the C code necessary to solve the problem vs. the perl code.

For example, splitting a string on whitespace in C takes multiple calls
to strtok() allocation and copying of strings all inside loop plus
allocation of an array.  The same thing in perl is a single call to
split().  Such an example might not only demonstrate to them how much
simpler the Perl solution is but also might convince them that the Perl
solution might be *easier* to understand.

Second, I'd try to explain that Perl isn't maybe as exotic as they
think.  You might cite the 3rd State of the Onion article at
http://www.perl.com/pub/1999/08/onion/talk1.html , which mentions that
according to their measurements of traffic on dice.com, Perl job
postings are more numerous than Visual Basic, second only to C++ and
Java.

If possible, it might also be a good idea to be more concrete than
that.  Giving them a list of resources of where you can get perl
programmers and perl training would be helpful.  Tell them about
recruiters, web sites, personal contacts, and anything else you can
think of that is a resource for finding Perl people.

Above all, I'd say try to figure out what their concerns are and figure
out whether they're valid.  If they are, then consider whether the pros
outweigh the cons and explain why you think they do if they do.  If
they're not valid, try to explain what the misconceptions are.

Hope that helps.

  - Logan


------------------------------

Date: Fri, 25 Aug 2000 11:16:33 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Sorting by a subfield
Message-Id: <MPG.141057db39805f3698ace2@nntp.hpl.hp.com>

In article <8o6738$v0u$1@nnrp1.deja.com> on Fri, 25 Aug 2000 16:32:41 
GMT, pape_98@my-deja.com <pape_98@my-deja.com> says...

 ...

> @sorted = map { $_->[0] }
>         sort { $a->[0] cmp $b->[0]
>                         ||
>                $a->[1] <=> $b->[1]
>         } map { [$_, /(\d+)/, uc($_)] } @unsorted;

 ...

> But the way I want it is :
> 
> *NIH,6B-4,01 36,13 5 26,15 43,1 5 2 5 2 4
> *NIH,9B-4,01 36,13 5 26,15 43,1 5 2 5 2 4
> NIH,10B-410,01 36,13 5 26,15 43,1 5 2 5 2 4
> NIH,15-410,01 36,13 5 26,15 43,1 5 2 5 2 4
> NIH,60B-410,01 36,13 5 26,15 43,1 5 2 5 2 4
> *NIH,B1D-43,01 36,13 5 26,15 43,1 5 2 5 2 4
> NIH,B1D-403,01 36,13 5 26,15 43,1 5 2 5 2 4
> NIH,B1D-410,52 51 36,135 256,15413,1512
> NIH,B1D-416,52,135 6,1513,52 hi,
> *Suburban,1B-29,52 51,5256,15 13,152
> Suburban,10C-58,52 51,5256,15 13,152

The above line is out of order on a numeric sort.  I will put it two 
lines lower.

> Suburban,6B-281,52 51,5256,15 13,152
> Suburban,6C-258,52 51,5256,15 13,152
> Suburban,ACardiology,52 51,5256,15 13,152
> Suburban,Office,52 51,5256,15 13,152
> 
> I put an * next to the lines that need to change.
> I hope everything is in the format that you want it this time.

Now it is possible to formulate the requirements explicitly, which you 
should learn how to do for future problems.

You want to sort lexicographically by the first field, then numerically 
by the number that starts the second field (if any) then by the letter 
in the second field (if any), then by number following a '-' in the 
second field (if any), finally lexicograpically by the second field.  
Whew!

Let's massage your Schwartz Transform into that.  If it still isn't what 
you want, please figure out how to work from this model.  I've spent 
more than enough time spoonfeeding you already!


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

my @sorted = map { $_->[5] }
        sort { $a->[0] cmp $b->[0]
                        ||
               $a->[2] <=> $b->[2]
                        ||
               $a->[3] cmp $b->[3]
                        ||
               $a->[4] <=> $b->[4]
                        ||
               $a->[1] cmp $b->[1]
         } map { my @a = (split /,/)[0, 1];
	       $a[2] = $a[1] =~ /^(\d+)/ ? $1 : 100000;
	       $a[3] = $a[1] =~ /^\d+(\w+)/ && $1;
	       $a[4] = $a[1] =~ /-(\d+)/ ? $1 : 100000; [@a, $_] } <DATA>;

print @sorted;
__END__
NIH,6B-4,01 36,13 5 26,15 43,1 5 2 5 2 4
NIH,9B-4,01 36,13 5 26,15 43,1 5 2 5 2 4
NIH,10B-410,01 36,13 5 26,15 43,1 5 2 5 2 4
NIH,15-410,01 36,13 5 26,15 43,1 5 2 5 2 4
NIH,60B-410,01 36,13 5 26,15 43,1 5 2 5 2 4
NIH,B1D-43,01 36,13 5 26,15 43,1 5 2 5 2 4
NIH,B1D-403,01 36,13 5 26,15 43,1 5 2 5 2 4
NIH,B1D-410,52 51 36,135 256,15413,1512
NIH,B1D-416,52,135 6,1513,52 hi,
Suburban,1B-29,52 51,5256,15 13,152
Suburban,10C-58,52 51,5256,15 13,152
Suburban,6B-281,52 51,5256,15 13,152
Suburban,6C-258,52 51,5256,15 13,152
Suburban,ACardiology,52 51,5256,15 13,152
Suburban,Office,52 51,5256,15 13,152



-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Fri, 25 Aug 2000 19:02:52 GMT
From: pape_98@my-deja.com
Subject: Re: Sorting by a subfield
Message-Id: <8o6fse$a7l$1@nnrp1.deja.com>


> > But the way I want it is :
> >
> > *NIH,6B-4,01 36,13 5 26,15 43,1 5 2 5 2 4
> > *NIH,9B-4,01 36,13 5 26,15 43,1 5 2 5 2 4
> > NIH,10B-410,01 36,13 5 26,15 43,1 5 2 5 2 4
> > NIH,15-410,01 36,13 5 26,15 43,1 5 2 5 2 4
> > NIH,60B-410,01 36,13 5 26,15 43,1 5 2 5 2 4
> > *NIH,B1D-43,01 36,13 5 26,15 43,1 5 2 5 2 4
> > NIH,B1D-403,01 36,13 5 26,15 43,1 5 2 5 2 4
> > NIH,B1D-410,52 51 36,135 256,15413,1512
> > NIH,B1D-416,52,135 6,1513,52 hi,
> > *Suburban,1B-29,52 51,5256,15 13,152
> > Suburban,10C-58,52 51,5256,15 13,152
>
> The above line is out of order on a numeric sort.  I will put it two
> lines lower.
>
I didn't know that

>If it still isn't what
> you want, please figure out how to work from this model.  I've spent
> more than enough time spoonfeeding you already!

Thanks though. I finally got it to work. :-)


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Fri, 25 Aug 2000 18:47:57 GMT
From: richie <rsmith@sympatico.ca>
Subject: Re: source question
Message-Id: <39A6BFD8.BD5D26B0@sympatico.ca>



Jim Mauldin wrote:

> I wrote:
> oops - carat in wrong place:
> $string1 = ~ s/=/\~/g;
>           ^ error is here
>
> Thanks Jim that fixed it, maybe you can shed some light on a related
> issue.

I have these lines like I showed you earlier:


$string1="origin_index_x=$coordx&origin_index_y=$coordy&origin_latlon_x=
$latlon_x&origin_latlon_y=$latlon_y&origin_click_x=$click_x&
origin_click_y=$click_y&origin_filename=$orig_filename";
$string1 =~ s/\=/\~/g;
print "\n <INPUT TYPE = hidden NAME = string VALUE= $string1>\n";

In the next script that string is taken here:

if ($ENV{'REQUEST_METHOD'} eq 'POST')
{

   # Get the input

     read(STDIN, $buffer1, $ENV{'CONTENT_LENGTH'});

   # Split the name-value pairs
   @pairs1 = split(/=/,$buffer1);

}

$pairs1[2]=~ s/\~/\=/g;

When I pass the value of pairs1 into the pathname for the browser, it
comes out like this:

origin_index_x%7E21%26origin_index_y%7E9%26origin_latlon_x%
7E5572313.32271897%26origin_latlon_y%7E4944360.74148591%26origin_click_x%

7E444%26origin_click_y%7E404%26origin_filename%
7El2_21_9.gif&destination_filename=l2_23_14.gif&level=2&coordx=23&coordy=14&x=484&y=326

when it should look like:

origin_index_x=21&origin_index_y=9&origin_latlon_x=5572313.32271897&
origin_latlon_y=4944360.74148591&origin_click_x=444&origin_click_y=404&
origin_filename=l2_21_9.gif&destination_filename=l2_23_14.gif&level=2&coordx=23&

coordy=14&x=484&y=326

Any help is once again very appreciated.

rich



------------------------------

Date: Fri, 25 Aug 2000 19:52:32 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: source question
Message-Id: <39A6CDF8.C3098691@netstorm.net>

richie wrote:
> 
> Jim Mauldin wrote:
> 
> > I wrote:
> > oops - carat in wrong place:
> > $string1 = ~ s/=/\~/g;
> >           ^ error is here
> >
> > Thanks Jim that fixed it, maybe you can shed some light on a related
> > issue.
> 
> I have these lines like I showed you earlier:
> 
> $string1="origin_index_x=$coordx&origin_index_y=$coordy&origin_latlon_x=
> $latlon_x&origin_latlon_y=$latlon_y&origin_click_x=$click_x&
> origin_click_y=$click_y&origin_filename=$orig_filename";
> $string1 =~ s/\=/\~/g;
> print "\n <INPUT TYPE = hidden NAME = string VALUE= $string1>\n";
> 
> In the next script that string is taken here:
> 
> if ($ENV{'REQUEST_METHOD'} eq 'POST')
> {
> 
>    # Get the input
> 
>      read(STDIN, $buffer1, $ENV{'CONTENT_LENGTH'});
> 
>    # Split the name-value pairs
>    @pairs1 = split(/=/,$buffer1);
> 
> }
> 
> $pairs1[2]=~ s/\~/\=/g;
> 
> When I pass the value of pairs1 into the pathname for the browser, it
> comes out like this:
> 
> origin_index_x%7E21%26origin_index_y%7E9%26origin_latlon_x%
> 7E5572313.32271897%26origin_latlon_y%7E4944360.74148591%26origin_click_x%
> 
> 7E444%26origin_click_y%7E404%26origin_filename%
> 7El2_21_9.gif&destination_filename=l2_23_14.gif&level=2&coordx=23&coordy=14&x=484&y=326
> 
> when it should look like:
> 
> origin_index_x=21&origin_index_y=9&origin_latlon_x=5572313.32271897&
> origin_latlon_y=4944360.74148591&origin_click_x=444&origin_click_y=404&
> origin_filename=l2_21_9.gif&destination_filename=l2_23_14.gif&level=2&coordx=23&
> 
> coordy=14&x=484&y=326
> 
> Any help is once again very appreciated.
> 
> rich

See perlfaq9 
http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfaq9.html
"How do I decode or create those %-encodings on the web?"

-- Jim


------------------------------

Date: Fri, 25 Aug 2000 21:05:38 GMT
From: richie <rsmith@sympatico.ca>
Subject: Re: source question
Message-Id: <39A6E01D.14EF1535@sympatico.ca>



Jim Mauldin wrote:

> See perlfaq9
> http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfaq9.html
> "How do I decode or create those %-encodings on the web?"
>
> -- Jim

Thanks Jim for directing me to the FAQ and not yelling at me that I should have checked there
first.



------------------------------

Date: Fri, 25 Aug 2000 18:59:24 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Stumped by Reg Exp Problem - help??
Message-Id: <MPG.14115f811c4ba509896f5@localhost>

Eli the Bearded <elijah@workspot.net> wrote ..
>In comp.lang.perl.misc, jason  <elephant@squirrelgroup.com> wrote:
>> oops
>> 
>>   <a href = "http://www.pedantic.com/">Pedantic</a>
>> 
>> HTML::Parser to the rescue .. check it out at a CPAN near you
>
>I was under the impression that this was not an HTML document.
>I don't want to think what kind of breakage HTML::Parser could
>do to non-HTML documents. (Imagine an news or email followup
>where the author used '<' instead of '>' to quote lines.)

but the originator specifically said that some of the URLs are already 
contained within anchor tags .. that would suggest that it's an HTML 
document

-- 
  jason -- elephant@squirrelgroup.com --


------------------------------

Date: 25 Aug 2000 19:13:03 GMT
From: abigail@foad.org (Abigail)
Subject: Re: stupid question probably
Message-Id: <slrn8qdh8i.tj3.abigail@alexandra.foad.org>

Thierry (info@ezboo.com.xx) wrote on MMDLI September MCMXCIII in
<URL:news:4Krp5.4907$6x7.5481612@nnrp5.proxad.net>:
$$ My Perl script works alone, but
$$ How the hell can I insert a small Perl script within my existing HTML page.

I'd do:

    <pre><code>
        Your Perl code goes here. Make sure to escape '<' and '&'.
    </code></pre>

But what does that have to do with Perl? You'd do the same for any other
language.

$$ For exemple to write date....

I don't follow you.



Abigail
-- 
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))


------------------------------

Date: 25 Aug 2000 19:24:16 GMT
From: abigail@foad.org (Abigail)
Subject: Re: To push or not to push
Message-Id: <slrn8qdhtk.tj3.abigail@alexandra.foad.org>

Keith Calvert Ivey (kcivey@cpcug.org) wrote on MMDL September MCMXCIII in
<URL:news:39a7776f.4636802@news.newsguy.com>:
<> Steven Merritt <smerr612@mailandnews.com> wrote:
<> 
<> >     if (/^\+>*/) {
<> 
<> That matches any line that starts with a plus sign followed by
<> zero or more greater-thans.  That is, the >* isn't doing
<> anything, since every plus sign is followed by at least zero
<> greater-thans.


Well, it does have side effects. It matters for $& and friends.



Abigail
-- 
($;,$_,$|,$\)=("\@\x7Fy~*kde~box*Zoxf*Bkiaox"," "x25,1,"\r");
{vec($_=>1+$"=>$^F<<$^F)=ord($/^substr$;=>$"=int rand 24=>1);
 print&&select$,,$,,$,,$|/($|+tr/ //c);redo if y/ //>$^F**2};


------------------------------

Date: 25 Aug 2000 19:32:48 GMT
From: abigail@foad.org (Abigail)
Subject: Re: uc problems
Message-Id: <slrn8qdidj.tj3.abigail@alexandra.foad.org>

Laurent de Lasteyrie (lasteyrie@iname.com) wrote on MMDLI September
MCMXCIII in <URL:news:39a65e73.251798747@news.issy.cnet.fr>:
"" 	I have to upcase the word with accents like "trélazé", there
"" is 2 accents in this word. I add "use locale;" at the beginning of my
"" program, and when i use "uc" it give me  "TRéLAZé". I try with the
"" command :
"" 	=~ tr/àâä|éèê|îï|ôö|ùûü/A|E|I|O|U/;
"" 	But, it give me back "TRILAZI",

What on earth make you think this is correct syntax? It doesn't even
remotely makes sense when applied to s/// either.

"" 	Does anyone can help me, please...

    %& = map {my $x = $_; map {$_ => $x -> [1]} split // => $x -> [0]}
             ["àâä" => "A"],
             ["éèê" => "E"],
             ["îï"  => "I"],
             ["ôö"  => "O"],
             ["ùûü" => "U"];
    s/./$&{$&}||$&/eg;



Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


------------------------------

Date: Fri, 25 Aug 2000 19:27:03 GMT
From: bob_orlando@my-deja.com
Subject: uninitialized value ... getpgrp.al
Message-Id: <8o6h9f$c0j$1@nnrp1.deja.com>

I am using the following user function/subroutine to determine
if the program is being run interactively.  It seems to work,
however, with the -w commandline option I receive the following
error:

Use of uninitialized value at \
/usr/local/lib/perl5/sun4-solaris/5.00404/auto/POSIX/getpgrp.al line 6.

Anyone know anything about this (or I'll take a better way
to determine whether running interactive or no)?

Thanks,

Bob Orlando
--
Bob.Orlando@bigfoot.com        http://www.orlandokuntao.com
-----------------------------------------------------------
Artificial intelligence is no match for natural stupidity.



#---------------------------------------------------------#
sub interactive
#---------------------------------------------------------#
{
   use POSIX qw(getpgrp tcgetpgrp);
   my $tty = "/dev/tty";

   local *TTY;
   open(TTY, "$tty") || return 0;
   my $tpgrp = tcgetpgrp(fileno(TTY));
   my $pgrp  = getpgrp();
   close TTY;
   return ($tpgrp == $pgrp);
}



Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Fri, 25 Aug 2000 19:51:27 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: URLs ending in /
Message-Id: <Pine.GHP.4.21.0008251945490.22396-100000@hpplus01.cern.ch>

On 25 Aug 2000, Abigail wrote:

> The browser only makes 2 requests if the server issues a redirect. Long time
> ago, when the web still looked like it could grow into something useful,

Well, that prediction was two-thirds-right.  The web grew into something.


[SCNR.  your f'up temporarily overridden]



------------------------------

Date: Fri, 25 Aug 2000 20:40:56 GMT
From: cbdeja@my-deja.com
Subject: Re: URLs ending in /
Message-Id: <8o6lkk$h5s$1@nnrp1.deja.com>

Oops, beg y' pardon.

I had been searching on Deja for the answer to this query and found
someone posting on the same subject here who seemed to know about this
but didn't expand upon it. My posting was a bit of a knee jerk reaction.

I promise not to do it again. :(

Colin

In article <39a63852.1306871381@news.cs.hut.fi>,
  Jukka.Korpela@hut.fi (Jukka Korpela) wrote:
> cbdeja@my-deja.com wrote:
>
> >What is the difference between the URLs (for example):
> >
> >  http://www.acme.com/support
> >  http://www.acme.com/support/
>
> This is not a Perl question at all. Please consult the Web Authoring
FAQ
> entry http://www.htmlhelp.com/faq/html/basics.html#url-slash
> And if problems remain, select a suitable group for further questions
on
> this.


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Fri, 25 Aug 2000 20:07:04 GMT
From: dunno2k@my-deja.com
Subject: what does "to spider" mean?
Message-Id: <8o6jko$esn$1@nnrp1.deja.com>



Suppose I have a link. What does it mean
to "spider" the link?

Thanks
dunno two kay



Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Fri, 25 Aug 2000 14:25:39 -0700
From: stevel@bluetuna.com (Steve Leibel)
Subject: Re: what does "to spider" mean?
Message-Id: <stevel-2508001425390001@192.168.100.2>

In article <8o6jko$esn$1@nnrp1.deja.com>, dunno2k@my-deja.com wrote:

> Suppose I have a link. What does it mean
> to "spider" the link?
> 

Given a link, you obtain the web page indicated by the link.  Then you
parse that page, looking for more links.  When you find a link, you spider
it.  That's how search engines index millions of pages.

This is not a Perl question, but you could have made it one by asking,
"How can I write a spider in Perl?" in which case people would point you
at the libwww-perl collection in CPAN, which includes the LWP package.

Steve L


------------------------------

Date: Fri, 25 Aug 2000 19:13:57 GMT
From: "Etienne Laverdiere" <info@digitaltango.com>
Subject: What is JPL? how to use it?
Message-Id: <Vzzp5.18476$Si1.326643@news20.bellglobal.com>

Hi all, What is JPL for? (Java Perl...ok) and how can I use it on windows
NT?

Is there a tutorial for that ?



Regards,


Etienne Laverdiere




------------------------------

Date: Fri, 25 Aug 2000 19:55:35 +0100
From: j <blah@cwcom.bkak.net>
Subject: Re: Where is the Perl Newbie or Begginers group?
Message-Id: <39A6C127.8B8561A@cwcom.nospam.net>



jason wrote:

> sysnovice <gdonovanNOgdSPAM@jeffco.k12.co.us.invalid> wrote ..
> >I am a Unix SysAd with no programming experience looking for
> >a discussion group for Perl beginners like myself that don't
> >have a clue. I'm so new I don't even know where to find
> >FAQ's. It's evident that from many postings here that the
> >experienced Perl programmers are more than a bit annoyed
> >with folks like myself posting "dumb" questions. Does
> >someone out there know of a group for the retarded perl
> >wanabes? If I could find such a place I would address all my
> >questions there until the year 2025 when I may have a
> >question intelligent enough for this discussion group.
>

I'm in the same boat as you Jason and lurk in this group picking up
knowledge and snippits of various Perl practices.
The reason for my response though is to recommend a book!!
Elements of programming Perl by Andrew Johnson (manning books) is aimed at a
complete newbie programmer and IMHO succeeds (so far).

For a complete non programmer I think its better than learning perl.
apologies to Randal & Tom, but if its any consolation I bought yours as
well.



------------------------------

Date: 25 Aug 2000 21:11:25 GMT
From: abigail@foad.org (Abigail)
Subject: Re: WORKIN WITH C in PERL
Message-Id: <slrn8qdo67.tj3.abigail@alexandra.foad.org>

Nail Ünlü (nail.uenlue@freesurf.ch) wrote on MMDL September MCMXCIII in
<URL:news:8o43g9$ao2$1@news.imp.ch>:
// 
// is there a way of executin a c programm under unix with perl and to read the
// output with stdin ???


Hmm, yeah. Did you try reading the manual?


Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


------------------------------

Date: 25 Aug 2000 21:23:01 GMT
From: abigail@foad.org (Abigail)
Subject: Re: would you recommend buying a book
Message-Id: <slrn8qdoro.tj3.abigail@alexandra.foad.org>

Tim Hammerquist (tim@degree.ath.cx) wrote on MMDXLIX September MCMXCIII
in <URL:news:slrn8q7gf8.66a.tim@degree.ath.cx>:
{} 
{} Book advice: If it's published by O'Reilly and includes Perl in the
{} title, it's worth the money.

Cargo cult. It's one of the most idiotic advices I've heard.

The Perl Cookbook, and Programming Perl (third edition) are worth the
money. And perhaps Learning Perl/Tk, but that's because there's no
alternative. Another Perl related book by O'Reilly that might be worth
the money is Mastering Regular Expressions, but that's quite dated and
doesn't describe any of the newer regex features.

There are some other Perl books that are worth their money, but they
ain't published by O'Reilly. (Elements of Programming Perl, Object
Oriented Perl, Perl: The Programmers Compagnion).

However, if you can afford only one book to assist you in programming in
Perl, there's really only one book (and surprisingly, it doesn't contain
any reference to Perl):

    "Advanced Programming in the Unix Environment"

by the late Stevens. Perl is Unix, even on non-Unix platforms. You can
hardly ask a question "Why is it done this way in Perl" without getting
the answer "because it's done so in Unix (be it a standard application,
a system function, or related to the standard C library, which was born
and raised on Unix).



Abigail
-- 
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()


------------------------------

Date: 25 Aug 2000 18:41:30 GMT
From: rpease@mets.micro.ti.com (Roger Daniel Pease)
Subject: Writing FAQs via PERL
Message-Id: <8o6ekq$o11$1@tilde.csc.ti.com>


I think I once heard that there was a module or methodology for writing FAQ's in PERL. 
The idea was that you enter the question and answer (for some topic often
completely unrelated to PERL) only once and the results would be printable in text, 
HTML, or whatever other format you choose to output. Unfortunately every time I look   
for 'PERL FAQ' in search engines/etc I get information about the PERL faq's.

I guess it'd be as simple as a list or assoc. array, but wondered if there was
some 'cooked' methodology so I wouldn't end up just doing it over again. 

Any pointers are appreciated. 

Thanks,

Roger
--



------------------------------

Date: 25 Aug 2000 21:29:52 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Wrong @INC in Apache
Message-Id: <slrn8qdp93.tj3.abigail@alexandra.foad.org>

Gabe (grichards@flashcom.net) wrote on MMDLI September MCMXCIII in
<URL:news:39A62925.4CC8E4EA@flashcom.net>:
== I realize this might not be a Perl issue, but I'm not sure so I'm
== posting to both groups.

Then you should have crossposted, not spammed.

(Both groups? Your server only has 2 groups?)

== After  installing 5.6.0 I deleted all the 5.00503 directories and
== programs. Upon boot, Apache tells me it  can't find Cwd.pm in @INC and
== it displays the contents of @INC. The @INC Apache is working with is for
== the 5.00503 distribution (i.e. /usr/lib/perl5/5.00503). Well, that
== directory doesn't exist anymore and @INC should contain things like
== /usr/lib/perl5/5.6.0/. Funny thing is, when I have Perl print out @INC
== it prints out what I expect. So apparently, somehow Apache is operating
== with the prior distribution's @INC, how do I get it to see the @INC for
== 5.6.0?

It looks like Perl is using a perl you didn't replace. Perhaps apache
has a perl buildin? If statically linked, you need to rebuild apache.
If dynamically linked, make sure the new library is in the place apache
expects it to be, and restart your apache.


Abigail
-- 
- What kind of music do you usually have here?
- Oh, we got both kinds. We got country *and* western.
                   ["Elwood Blues" and "Claire" in `The Blues Brothers', 1980]


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 4135
**************************************


home help back first fref pref prev next nref lref last post