[22490] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4711 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 14 21:05:38 2003

Date: Fri, 14 Mar 2003 18:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 14 Mar 2003     Volume: 10 Number: 4711

Today's topics:
        [ANNOUNCE] wxPerl 0.13 <mbarbon@delete_me.dsi.unive.it>
        [Probably] a stupid question about REGEX (Mark Healey)
    Re: [Probably] a stupid question about REGEX <noreply@gunnar.cc>
    Re: [Probably] a stupid question about REGEX <ddunham@redwood.taos.com>
    Re: [Probably] a stupid question about REGEX (Anno Siegel)
    Re: [Probably] a stupid question about REGEX <glex_nospam@qwest.net>
    Re: ActiveState 5.6 - Making a local repository? <bobx@linuxmail.org>
    Re: AIX 5.1 perl 5.6 perldiag.pod flawed <ekulis@apple.com>
    Re: AIX 5.1 perl 5.6 perldiag.pod flawed <mgjv@tradingpost.com.au>
        Deployment of semi-large-ish Perl project <nospam@nospam.net>
        frames without files ? <ericosman@rcn.com>
    Re: frames without files ? <spam@thecouch.homeip.net>
    Re: how to convert special characters to html entities? (Mike Judkins)
    Re: how to convert special characters to html entities? <me@verizon.invalid>
    Re: it's true but can I say so ? <mgjv@tradingpost.com.au>
    Re: it's true but can I say so ? <abigail@abigail.nl>
    Re: it's true but can I say so ? <mgjv@tradingpost.com.au>
    Re: map - sort - lc in one statement <goldbb2@earthlink.net>
    Re: map - sort - lc in one statement <krahnj@acm.org>
    Re: Merging log files using hash - good idea/possible? <singleantler-news@hotmail.com>
    Re: pass multiple lines in ? <peakpeek@purethought.com>
        Send files from FORM to Mail in Outlook <timgbp@tims.ericsson.se>
    Re: What's wrong with the Perl docs <abigail@abigail.nl>
    Re: What's wrong with the Perl docs <goldbb2@earthlink.net>
    Re: where's $1? <prlawrence@lehigh.edu>
    Re: where's $1? <goldbb2@earthlink.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 14 Mar 2003 19:52:22 GMT
From: Mattia Barbon <mbarbon@delete_me.dsi.unive.it>
Subject: [ANNOUNCE] wxPerl 0.13
Message-Id: <Xns933DDC155E24Dmbarbondsiuniveit@192.168.9.1>

A new version of wxPerl, the Perl bindings to wxWindows, is out!

wxWindows is a free and cross platform (Windows/Motif/GTK/Mac) C++ GUI
toolkit with native look and feel.  (visit http://www.wxwindows.org/
for details).

You can download wxPerl sources from
$CPAN/authors/id/M/MB/MBARBON/Wx-0.13.tar.gz;

Binary packages for ActivePerl/Win32 6xx builds and Red Hat Linux are
available along with documentation in HTML and MS HTML Help format
from http://wxperl.sourceforge.net/

The project home page is http://wxperl.sourceforge.net/. There is also
a mailing list dedicated to wxPerl users:
wxperl-users@lists.sourceforge.net

Changes since the last version:
	- new DEPRECATIONS section in README.txt, please read it
	- New build system, allows building wxPerl extension written using
	  XS outside of the wxPerl tree.
	- Added Wx::Wave
	- Added Wx::MemoryFSHandler
	- Added Wx::Perl::Carp (thanks to podmaster).
	- Mac OS X support (requires wxWindows 2.4.0 or newer).
	- Added Wx::Socket* (thanks to Graciliano M. P.)

Regards
Mattia



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

Date: 14 Mar 2003 18:35:00 -0600
From: die@spammer.die (Mark Healey)
Subject: [Probably] a stupid question about REGEX
Message-Id: <VP2SpNyJrzMZ-pn2-HSMQdnFBCHUH@adsl-63-207-135-60.dsl.sndg02.pacbell.net>


For the life of me I can't figure out how to do a regex comparison
between $_ and $anyVariable.

You can see my attempt on line 54.  I've tried $last =~ /$_/i as well
with no results.

I'm probably missing something simple but can't seem to find it.


     48       foreach(@lines)
     49          {
     50          if (/\A">/)
     51             {
     52             foreach(@searchTerms)
     53                {
     54                if (/$_/i =~ $last)
     55                   {
     56                   push(@descriptions, $last);
     57                   }
     58                }#end foreach searchTerms
     59             }
     60          $last = $_;
     61          }# end foreach lines






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

Date: Sat, 15 Mar 2003 01:59:33 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: [Probably] a stupid question about REGEX
Message-Id: <b4tu64$2439b8$1@ID-184292.news.dfncis.de>

Mark Healey wrote:
> For the life of me I can't figure out how to do a regex comparison
> between $_ and $anyVariable.

You'd better give us a couple of example strings, and explain (in 
English) which kind of comparison(s) you want to do.

/ Gunnar

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Sat, 15 Mar 2003 01:15:19 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: [Probably] a stupid question about REGEX
Message-Id: <H8vca.1594$hh6.163167407@newssvr13.news.prodigy.com>

Mark Healey <die@spammer.die> wrote:

> For the life of me I can't figure out how to do a regex comparison
> between $_ and $anyVariable.

How do you want to compare them?

> You can see my attempt on line 54.  I've tried $last =~ /$_/i as well
> with no results.

"no results".  No errors?

It would be easiest if you put together a small script that gave output
you didn't expect and told us what you did expect.

> I'm probably missing something simple but can't seem to find it.
>      48       foreach(@lines)                    
>      49          {
>      50          if (/\A">/)
>      51             {
>      52             foreach(@searchTerms)
>      53                {
>      54                if (/$_/i =~ $last)
>      55                   {
>      56                   push(@descriptions, $last);
>      57                   }
>      58                }#end foreach searchTerms
>      59             }
>      60          $last = $_;
>      61          }# end foreach lines

Huh..  $last is undefined until you reach line 60 for the first time?  I
think your use of $_ is likely causing problems here.  Perhaps you
should use an explicit loop variable.

Does this do what you expect? It uses variables for pattern matching in
a loop against a number of items.

#!/usr/bin/perl -w
use strict;
my @list = qw(there are some words here that will have cheap letters);
my $search_string = "he";

foreach my $item (@list)
{
  if ($item =~ m/$search_string/)
  {  print "String $search_string was found in the item >$item<\n"; }
}

-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >


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

Date: 15 Mar 2003 01:18:20 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: [Probably] a stupid question about REGEX
Message-Id: <b4tv0s$m4e$1@mamenchi.zrz.TU-Berlin.DE>

Gunnar Hjalmarsson  <noreply@gunnar.cc> wrote in comp.lang.perl.misc:
> Mark Healey wrote:
> > For the life of me I can't figure out how to do a regex comparison
> > between $_ and $anyVariable.
> 
> You'd better give us a couple of example strings, and explain (in 
> English) which kind of comparison(s) you want to do.

Risking a WAG, it's probably a case of missing quotemeta.  The OP
should try "$anyVariable =~ /\Q$_/i;

Anno


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

Date: Fri, 14 Mar 2003 19:31:33 -0600
From: Jeff D Gleixner <glex_nospam@qwest.net>
Subject: Re: [Probably] a stupid question about REGEX
Message-Id: <glvca.639$la3.130907@news.uswest.net>

Mark Healey wrote:
> For the life of me I can't figure out how to do a regex comparison
> between $_ and $anyVariable.
> 
> You can see my attempt on line 54.  I've tried $last =~ /$_/i as well
> with no results.
> 
> I'm probably missing something simple but can't seem to find it.
> 
> 
>      48       foreach(@lines)
>      49          {
>      50          if (/\A">/)
>      51             {
>      52             foreach(@searchTerms)
>      53                {
>      54                if (/$_/i =~ $last)
>      55                   {
>      56                   push(@descriptions, $last);
>      57                   }
>      58                }#end foreach searchTerms
>      59             }
>      60          $last = $_;
>      61          }# end foreach lines

Are you sure it's getting to the foreach loop on line 52??  That
if on line 50 looks odd.

If so, to be safe,  try:

54     if (/\Q$last/i)





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

Date: Fri, 14 Mar 2003 19:20:56 GMT
From: "Bob X" <bobx@linuxmail.org>
Subject: Re: ActiveState 5.6 - Making a local repository?
Message-Id: <sYpca.800$FN.420955@news2.news.adelphia.net>

A couple of Linux mags ago Mr. Schwartz did some articles on creating your
own local repository. His fit on a CD if I recall correctly.

Bob




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

Date: Fri, 14 Mar 2003 13:55:17 -0800
From: Ed Kulis <ekulis@apple.com>
Subject: Re: AIX 5.1 perl 5.6 perldiag.pod flawed
Message-Id: <BA978FC5.64BC%ekulis@apple.com>

On 3/13/03 6:22 PM, in article slrnb72f71.bkm.mgjv@verbruggen.comdyn.com.au,
"Martien Verbruggen" <mgjv@tradingpost.com.au> wrote:

> On Thu, 13 Mar 2003 17:13:42 -0800,
> Ed Kulis <ekulis@apple.com> wrote:
>> Hi,
>> 
>> It seems that perl installs on new AIX servers is flawed.  I've run into
>> this problem on server after server in both AIX 4.3 and 5.1.
>> 
>> $ cat lib_test.pl
>> #!/usr/bin/perl -w
>> 
>> use diagnostics;
>> 
>> $  ./lib_test.pl
>> couldn't find diagnostic data in /usr/opt/perl5/lib/5.6.0/pods/perldiag.pod
> 
> Looks like perldiag.pod isn't installed.
> 
> What does
> 
> $ perldoc perldiag
> 
> do?
> 

Here's what perldoc does?


$ perldoc
Usage: perldoc [-h] [-r] [-i] [-v] [-t] [-u] [-m] [-n program] [-l] [-F]
[-X] PageName|ModuleName|ProgramName
       perldoc -f PerlFunc
       perldoc -q FAQKeywords

The -h option prints more help.  Also try "perldoc perldoc" to get
acquainted with the system.
$ perldoc perldiag
No documentation found for "perldiag".
$ 
$ perldoc perl    
No documentation found for "perl".
$ perldoc while
No documentation found for "while".
$ perldoc chomp
No documentation found for "chomp".



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

Date: Sat, 15 Mar 2003 10:04:49 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: AIX 5.1 perl 5.6 perldiag.pod flawed
Message-Id: <slrnb74o0h.j8t.mgjv@martien.heliotrope.home>

On Fri, 14 Mar 2003 13:55:17 -0800,
	Ed Kulis <ekulis@apple.com> wrote:
> On 3/13/03 6:22 PM, in article slrnb72f71.bkm.mgjv@verbruggen.comdyn.com.au,
> "Martien Verbruggen" <mgjv@tradingpost.com.au> wrote:
> 
>> On Thu, 13 Mar 2003 17:13:42 -0800,
>> Ed Kulis <ekulis@apple.com> wrote:

>>> $  ./lib_test.pl
>>> couldn't find diagnostic data in /usr/opt/perl5/lib/5.6.0/pods/perldiag.pod
>> 
>> Looks like perldiag.pod isn't installed.

> Here's what perldoc does?

> $ perldoc perldiag
> No documentation found for "perldiag".
> $ perldoc perl    
> No documentation found for "perl".

You have a broiken installation of Perl. Talk to your sys admins, and
get them to install it correctly. Refer to my earlier post for one or
two things that could be wrong.

> $ perldoc while
> No documentation found for "while".

This will never work; while is described in perlsyn.

> $ perldoc chomp
> No documentation found for "chomp".

And this should have been

$ perldoc -f chomp

because that's how you check the documentation for builtin functions.

Martien
-- 
                        | 
Martien Verbruggen      | That's not a lie, it's a terminological
                        | inexactitude.
                        | 


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

Date: Fri, 14 Mar 2003 20:51:57 +0100
From: Henk van Bree <nospam@nospam.net>
Subject: Deployment of semi-large-ish Perl project
Message-Id: <3e7232c2$0$49106$e4fe514c@news.xs4all.nl>


Hi,

I'm starting design on a somewhat large-ish project (data visualisation), 
having around 150-170 Perl source files. User interface is preferred to be 
Qt, but this can change if need be, as long as isn't web-based (due to 
latency). Interfaces to Oracle RDBMS will be used. Application should be 
able to run on both GNU/Linux and Microsoft Windows on geographically 
spread out machines.

Before starting however, I'd like to get your inputs on how to deploy this
application on the client PC's.

Is there a way to bundle all the files in a single binary? If not, how can
I make sure users don't (accidentally) tamper with the files? Would Qt be
a problem?

I'm not concerned with source 'secrecy' (client pays for source) but I am
concerned with source tampering and/or accidental deletion/corruption of
files.

What's your take on this?

Regards,
Henk



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

Date: Fri, 14 Mar 2003 15:12:07 -0500
From: Eric Osman <ericosman@rcn.com>
Subject: frames without files ?
Message-Id: <3E723797.8090601@rcn.com>


Hi,

I've got a Perl CGI that takes as its input some text the user pastes
into an HTML TEXTAREA.

When user clicks on the SUBMIT button, the Perl CGI then writes the text
back with enhancing HTML tags (to add hotspots, for example) .

But here's the clincher:

Now I want to enhance the Perl so that it adds a table of contents
frame.  Because of SECURITY I'd rather not write any files.

When it was just the one page being written back, it was simple, as
I just put in "print" lines in Perl to write HTML code back to the
browser.

But if I want my Perl to generate a frameset page pointing at two other
pages (the table of contents and the body), is there a way I can do this
without writing auxiliary disk files ?

Thanks.  /Eric



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

Date: Fri, 14 Mar 2003 20:56:33 -0500
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: frames without files ?
Message-Id: <sLvca.15426$6L3.225779@wagner.videotron.net>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Eric Osman wrote:
> 
> Hi,
> 
> I've got a Perl CGI that takes as its input some text the user pastes
> into an HTML TEXTAREA.
> 
> When user clicks on the SUBMIT button, the Perl CGI then writes the text
> back with enhancing HTML tags (to add hotspots, for example) .
> 
> But here's the clincher:
> 
> Now I want to enhance the Perl so that it adds a table of contents
> frame.  Because of SECURITY I'd rather not write any files.
> 
> When it was just the one page being written back, it was simple, as
> I just put in "print" lines in Perl to write HTML code back to the
> browser.
> 
> But if I want my Perl to generate a frameset page pointing at two other
> pages (the table of contents and the body), is there a way I can do this
> without writing auxiliary disk files ?

Not really perl related, but you can have perl output your page as 
normal, but include in it some javascript code that populates the 
secondary "table of contents" frame from the main "content" frame.


-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+cohWeS99pGMif6wRAg5yAKDHgif7ICFU5+w89OxTrB7PaGS2twCgid+R
vyUVYZqc8kAo9cawC3t2vIg=
=vpwO
-----END PGP SIGNATURE-----



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

Date: 14 Mar 2003 12:09:31 -0800
From: mikeyjudkins@yahoo.com (Mike Judkins)
Subject: Re: how to convert special characters to html entities?
Message-Id: <17e1ae4c.0303141209.55b91f6d@posting.google.com>

> why not just use the hex codes for those characters:
>    $title =~ s/[\xE1]/&agrave;/g

I tried that but it is not finding the match. Its still outputing the
$title with the special characters once its passed through that
replacement pattern.


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

Date: Fri, 14 Mar 2003 20:38:36 GMT
From: "dw" <me@verizon.invalid>
Subject: Re: how to convert special characters to html entities?
Message-Id: <g5rca.55638$gi1.51237@nwrdny02.gnilink.net>


"Mike Judkins" <mikeyjudkins@yahoo.com> wrote in message
news:17e1ae4c.0303141209.55b91f6d@posting.google.com...
> > why not just use the hex codes for those characters:
> >    $title =~ s/[\xE1]/&agrave;/g
>
> I tried that but it is not finding the match. Its still outputing the
> $title with the special characters once its passed through that
> replacement pattern.

Here is the short program I wrote followed by its output.
You will note that I used the hex code for the aacute and I used the code
you used for the agrave.  Both seemed to work for me.  (Of course, the other
characters are still the same since I didn't add those lines.)

#!perl

$msg = q{
which contains special characters such as á, T, ë, etc, to the

$title =~ s/T/&trade;/g;
$title =~ s/®/&reg;/g;
$title =~ s/á/&aacute;/g;
$title =~ s/à/&agrave;/g;

á, T, ë, ®, à, á, T, ë, ®, à
};

$title = $msg;
$title =~ s/[\xE1]/&aacute;/g;
$title =~ s/à/&agrave;/g;

print "----before:----\n$msg\n";
print "----after:----\n$title\n";

__END__


----before:----

which contains special characters such as á, T, ë, etc, to the

$title =~ s/T/&trade;/g;
$title =~ s/®/&reg;/g;
$title =~ s/á/&aacute;/g;
$title =~ s/à/&agrave;/g;

á, T, ë, ®, à, á, T, ë, ®, à

----after:----

which contains special characters such as &aacute;, T, ë, etc, to the

$title =~ s/T/&trade;/g;
$title =~ s/®/&reg;/g;
$title =~ s/&aacute;/&aacute;/g;
$title =~ s/&agrave;/&agrave;/g;

&aacute;, T, ë, ®, &agrave;, &aacute;, T, ë, ®, &agrave;





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

Date: Sat, 15 Mar 2003 10:10:46 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: it's true but can I say so ?
Message-Id: <slrnb74obm.j8t.mgjv@martien.heliotrope.home>

On Fri, 14 Mar 2003 04:02:45 GMT,
	Jürgen Exner <jurgenex@hotmail.com> wrote:
> Martien Verbruggen wrote:
>> IOW, don't expect things like
>>
>>     if ($variable == true)
>> and
>>     if ($variable == false)
>> to work the same as
> 
> Quite true.
> But regardless of the programming language writing such code shows a blatant
> ignorance about Boolean algebra to begin with and is a sure way to tell that
> the programmer is not up to the task.Writing this in homework won't generate
> a fail but it is a sure-fire way to generate some lengthy comment.
> 
> But good to point it out, anyway.

You would be surprised how many people would try to do things like that,
though. And of course, in a language with real boolean types, this will
work (provided comparison is defined for boolean variables and I see no
reason for it not to be). It can even have its use, comparing two
boolean variables to each other (XOR functionality), but comparing a
boolean variable againt true or false, is indeed odd. 

But, again, I've seen many people try it. And in languages where boolean
truth and falseness isn't a bipolar situation, that's really broken.

Martien
-- 
                        | 
Martien Verbruggen      | For heaven's sake, don't TRY to be cynical.
                        | It's perfectly easy to be cynical.
                        | 


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

Date: 15 Mar 2003 00:27:52 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: it's true but can I say so ?
Message-Id: <slrnb74ss8.6og.abigail@alexandra.abigail.nl>

Martien Verbruggen (mgjv@tradingpost.com.au) wrote on MMMCDLXXXII
September MCMXCIII in <URL:news:slrnb74obm.j8t.mgjv@martien.heliotrope.home>:
-:  
-:  But, again, I've seen many people try it. And in languages where boolean
-:  truth and falseness isn't a bipolar situation, that's really broken.


Many people, including myself, wouldn't call SQL really broken.


Abigail
-- 
# Count the number of lines; code doesn't match \w. Linux specific.
()=<>;$!=$=;($:,$,,$;,$")=$!=~/.(.)..(.)(.)..(.)/;
$;++;$*++;$;++;$*++;$;++;`$:$,$;$" $. >&$*`; 


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

Date: Sat, 15 Mar 2003 12:32:56 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: it's true but can I say so ?
Message-Id: <slrnb750m8.j8t.mgjv@martien.heliotrope.home>

On 15 Mar 2003 00:27:52 GMT,
	Abigail <abigail@abigail.nl> wrote:
> Martien Verbruggen (mgjv@tradingpost.com.au) wrote on MMMCDLXXXII
> September MCMXCIII in <URL:news:slrnb74obm.j8t.mgjv@martien.heliotrope.home>:
> -:  
> -:  But, again, I've seen many people try it. And in languages where boolean
> -:  truth and falseness isn't a bipolar situation, that's really broken.
> 
> 
> Many people, including myself, wouldn't call SQL really broken.

But in SQL, truth and falseness _is_ a bipolar situation.

Martien
-- 
                        | 
Martien Verbruggen      | For heaven's sake, don't TRY to be cynical.
                        | It's perfectly easy to be cynical.
                        | 


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

Date: Fri, 14 Mar 2003 14:22:29 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: map - sort - lc in one statement
Message-Id: <3E722BF5.F8E6248D@earthlink.net>

Peter Shankey wrote:
> 
> #!/bin/perl
> 
> #give data in the form of:
> my @lines = qw(
> aaa:bbb:Y
> aaA:bbB:y
> aAa:bBb:Y
> aAA:bBB:y
> ccc:ddd:y
> ccC:ddD:y
> cCc:dDd:Y
> cCC:dDD:y
> aaa:bbb:Y
> aaA:bbB:y
> aAa:bBb:Y
> aAA:bBB:y
> ccc:ddd:y
> ccC:ddD:y
> cCc:dDd:Y
> cCC:dDD:y
> );
> 
> I want the second column (b's and d's) to be case sensitive on a sort
> and the primary column in the sort. As in reality the second column is
> a unix # directory path.
> The first column is not case sensitive. I want the entries ordered
> alpha-numeric. The first column is the secondary sort

If you merely want to sort the data as you're describing, then the
following is sufficient.

@lines = map $_->[0], sort {
      $$a[2]  cmp    $$b[2]  or
   lc($$a[1]) cmp lc($$b[1]);
} map [ $_, split /:/ ], @lines;

print $_, "\n" for @lines;

If you want to actually lower-case the first column, and print it out
that way, then try this:

@lines = map join(':',@$_), sort {
   $$a[1] cmp $$b[1]  or
   $$a[0] cmp $$b[0];
} map {
   my ($a, $b, $rest) = split /:/, $_, 3;
   [ lc($a), $b, $rest ];
} @lines;

print $_, "\n" for @lines;

[untested]


-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}


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

Date: Fri, 14 Mar 2003 22:48:18 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: map - sort - lc in one statement
Message-Id: <3E725C27.A9A216A7@acm.org>

Peter Shankey wrote:
> 
> #!/bin/perl
> 
> #give data in the form of:
> my @lines = qw(
> aaa:bbb:Y
> aaA:bbB:y
> aAa:bBb:Y
> aAA:bBB:y
> ccc:ddd:y
> ccC:ddD:y
> cCc:dDd:Y
> cCC:dDD:y
> aaa:bbb:Y
> aaA:bbB:y
> aAa:bBb:Y
> aAA:bBB:y
> ccc:ddd:y
> ccC:ddD:y
> cCc:dDd:Y
> cCC:dDD:y
> );
> 
> # I want the second column (b's and d's) to be case sensitive on a sort and
> the
> # primary column in the sort. As in reality the second column is a unix
> # directory path.
> # The first column is not case sensitive. I want the entries ordered
> # alpha-numeric. The first column is the secondary sort
> 
> # I found I could do this in 2 steps:
> @lines = map { $_->[0] }
>  sort {
>   $a->[2] cmp $b->[2]
>           ||
>   lc($a->[1]) cmp lc($b->[1])
>           ||
>   lc($a->[3]) cmp lc($b->[3])
>  }
>  map { [ $_, (split /:/) ] }
>  @lines;
> 
> @lines = map { join ':', lc($_->[0]), $_->[1], lc($_->[2]) }
>  map { [ @_,@_,@_, (split /:/) ] }
>  @lines;
> 
> foreach (@lines){
>  print($_, "\n");
> }
> 
> # I tied to combine the lines into one line but I could not get it to work
> # Is there anyway to combine the two steps into one?

This looks loke the perfect place for a GRT.  This produces the same
results as yours.

@lines = map join( ':', (split /:/)[1,0,2] ),
         sort
         grep s/^([^:]+):([^:]+):([^:]+)$/$2:\L$1:$3/,
         @lines;

print "$_\n" for @lines;



John
-- 
use Perl;
program
fulfillment


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

Date: Fri, 14 Mar 2003 20:01:40 +0000
From: Paul Silver <singleantler-news@hotmail.com>
Subject: Re: Merging log files using hash - good idea/possible?
Message-Id: <qtc47v4mp3d7sb6lvvv21dfphhrkjgp9t4@4ax.com>

On 13 Mar 2003 09:51:45 -0800, (Thomas) wrote:
>I am however not completely sure if we are talking about the same
>problem: merging logfiles would have worked perfectly if I just wanted
>to combine logfiles from different sites into one report. My problem
>is that one web site is running on two servers, and the visitors (even
>within one session) are ramdomly served by them. This created the
>visit count problem described above.

Ah, here I have an advantage: the cluster software randomly assigns a
visitor to a server when they first come in, but then they are always
routed to the same server unless there is a problem or a very long
delay between requests. Generally this means Webtrends has a slightly
better time tracking them.

If you were to go the scripted-merging route I suppose you could
remove/change the identifying string which tells the software which
server served which page, which should stop the problem. Hmm, but then
you might lose useful information like one server being used less than
the other/s because it has an intermittent problem that's not showing
up yet. 


Paul.
-- 
To e-mail, please remove '-news' from address.


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

Date: Fri, 14 Mar 2003 21:03:41 +0000
From: Sharon Grant <peakpeek@purethought.com>
Subject: Re: pass multiple lines in ?
Message-Id: <sfg47v4fv7jqdo777uucfki94h6ss1fv61@4ax.com>

On Fri, 14 Mar 2003 08:35:13 -0800, in comp.lang.perl.misc, "Alan C." <a@c.com> wrote:

>"Eric Osman" <ericosman@rcn.com> wrote in message
>news:3E71DADB.1070209@rcn.com...
>>
>>
>> &gt;  In the CGI context a browser will send textarea line breaks
>> &gt;  URL-encoded. CGI.pm will decode. Just use %0D%0A
>> &gt;
>> &gt;  perl reFormat.pl digestContents="123%0D%0A456%0D%0A567%0D%0A"
>>
>>
>> Thanks Sharon.  Your solution worked well !     /Eric
>>
>News to me.  That is, the issue of whenever a web browser's address bar slot
>or field became the same thing as the windows command line. Glad a solution
>for you

Your @ARGV suggestion was correct. However, a script which uses the 
CGI.pm module does not need to look at @ARGV, because CGI.pm handles 
@ARGV itself

This is a very handy feature of the CGI.pm module. It allows 
developers to test CGI scripts from the command line with minimal 
effort

-- 
Sharon


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

Date: Fri, 14 Mar 2003 17:31:37 -0600
From: timgbp <timgbp@tims.ericsson.se>
Subject: Send files from FORM to Mail in Outlook
Message-Id: <3E726659.1010501@tims.ericsson.se>

Hi;

How I can send archives by means of a Form in attachment, for example 
documents of Word, Excel, pdf.

With a cgi.

Regards. Guillermo



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

Date: 14 Mar 2003 23:12:03 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: What's wrong with the Perl docs
Message-Id: <slrnb74oe2.6og.abigail@alexandra.abigail.nl>

Andras Malatinszky (nobody@dev.null) wrote on MMMCDLXXXII September
MCMXCIII in <URL:news:3E713B41.8000408@dev.null>:
[]  
[]  
[]  Abigail wrote:
[]  
[] > Tintin (me@privacy.net) wrote on MMMCDLXXXI September MCMXCIII in
[] > <URL:news:b4pini$21mr4q$1@ID-172104.news.dfncis.de>:
[] > ..  Anyone seen http://clueless.justsomeguy.com/
[] > ..  
[] > ..  Anyone agree with any of his points?
[] > 
[]  [snip]
[] > 
[] > ++    * References and tutorials are still mixed up
[] > 
[] > Mixed up in which sense? If I type 'man perl', I find a list of
[] > tutorials on the first page.
[]  
[]  Funny, when I type 'man perl', I get a 'Bad command or file name' error 
[]  message.

So? Install cygwin. Use the HTML files that come with the ActiveState
build. Use perldoc. Use pod2latex, LaTeX and a dviviewer. Whatever.
It's not that you don't have the manual page with just a few keystrokes.

[]           Which leads me to another point. Too often it is assumed that 
[]  all Perl users are on a Unix box with interactive access, when in fact 
[]  many of us are on Windows machines, or perhaps with FTP and HTTP access 
[]  to a web server on a remote Unix box, where the only way to run a Perl 
[]  program is via CGI.

It's not Perl's fault that you cripple yourself in that way. Perl runs 
fine from the command line. On Unix *AND* on Windows. If your only way to
run Perl is via CGI, *YOU* are to blame, not Perl.

[] > ++    * Some functions documented by saying "works like it does in C"
[] > 
[] > Yes, and? Some functions are delegated to the C library. They will work
[] > the same way as in C. Consult your systems manual page; it will be your
[] > best resort, as such functions may not behave the same on all platforms
[] > Perl runs on. Perl is at the mercy of your system, not only for the
[] > working of the function, but also for its documenation.
[]  
[]  That's another example of the same Unix-centric view. The implicit 
[]  promise is that Perl  will run on other platforms, so it's not 
[]  unreasonable to expect that the docs be comprehensible without access to 
[]  a Unix box or some form of C documentation.

Perl running on Windows is not going to use some kind of C library
from a Unix system. So, suggesting that Perl should ship documentation
of a Unix C library is silly. It would useless on a Windows system.

Perl is using your system's libraries. If you choose to use a system
that doesn't come with a documentation, don't blame Perl. Blame yourself
for using an underdocumented OS, and paying for the priviledge.

[]  Let me concede before someone else rubs it in: nothing *has to* be any 
[]  particular way in software that the user is not paying for. But the OP's 
[]  perspective is to constructively point out problems with Perl and its 
[]  docs, and in this context this is a legitimate gripe.
[]  
[]  To put it in a different perspective, you may have to wade through 
[]  fewer stupid questions in clpm if there are more examples in the docs.

Patches welcome.

[] > I've just one question for you:
[] > 
[] >     What's your contribution going to be to fix the points brought up?
[] > 
[]  I think the OP's contribution is that he brought up some problems. 


That was not much of a contribution. I say it was wining. 



Abigail
-- 
               split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_)  {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};


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

Date: Fri, 14 Mar 2003 20:07:27 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: What's wrong with the Perl docs
Message-Id: <3E727CCF.E73CD426@earthlink.net>

Andras Malatinszky wrote:
> Abigail wrote:
> > Tintin wrote on MMMCDLXXXI September MCMXCIII:
> > ..  Anyone seen http://clueless.justsomeguy.com/
> > ..
> > ..  Anyone agree with any of his points?
[snip]
> > ++  * Some functions documented by saying "works like it does in C"
> >
> > Yes, and? Some functions are delegated to the C library. They will
> > work the same way as in C. Consult your systems manual page; it will
> > be your best resort, as such functions may not behave the same on
> > all platforms Perl runs on. Perl is at the mercy of your system, not
> > only for the working of the function, but also for its documenation.
> 
> That's another example of the same Unix-centric view. The implicit
> promise is that Perl  will run on other platforms, so it's not
> unreasonable to expect that the docs be comprehensible without access
> to a Unix box or some form of C documentation.

It's not just that perl will *run* on other platforms, it's that perl
will *compile and run* on other platforms.  If you can compile perl,
then you have a C compiler.  And that C compiler should come with
documentation for the C runtime library.  If the compiler doesn't come
with docs, then you didn't getting your money's worth when you bought
it.

So, it's not an example of a Unix-centric view, it's an example of a
"you've compiled your own perl"-centric view.

The only reason you might not have the documentation is if someone has
given you a precompiled perl, and has chosen to omit the documentation
for the C runtime with which it was compiled.  That's not perl's fault;
it's the fault of the person who gave you the precompiled perl.

Outside of the Windows world, how many perl programmers download
precompiled perls?

An inside of the Windows world, how many perl programmers don't have
internet connections, or otherwise can't connect to
    http://msdn.microsoft.com/library/
?

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}


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

Date: Fri, 14 Mar 2003 13:38:16 -0500
From: Phil R Lawrence <prlawrence@lehigh.edu>
Subject: Re: where's $1?
Message-Id: <3E722198.5070609@lehigh.edu>

Malcolm Dew-Jones wrote:
> Phil R Lawrence (prlawrence@lehigh.edu) wrote:
> : Geez,  this is so basic...  I want to capture 'http://' in $1.  What am 
> : I doing wrong?
> 
> :    DB<1> $url = 'http://www.lehigh.edu/foo'
> 
> :    DB<2> $url =~ s{^(.*//)}{}
> 
> :    DB<3> print $1
> 
> :    DB<4> print $url
> : www.lehigh.edu/foo
> 
> 
>  
> 	$url = 'http://www.lehigh.edu/foo';
> 	$url =~ s{^(.*//)}{};
> 	print $1;
> 	print $/; # add line break
> 	print $url;
>     
> works for me as a script.  perhaps the debugger is not.

Yep.  Can someone explain what scope issue is going on between debugger 
lines?


   DB<1> $url = 'http://www.lehigh.edu/foo'

   DB<2> $url =~ s{^(.*//)}{} ; print $1
http://
   DB<3> print $url
www.lehigh.edu/foo
   DB<4>

Thanks,
Phil R Lawrence



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

Date: Fri, 14 Mar 2003 14:39:21 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: where's $1?
Message-Id: <3E722FE9.D525D773@earthlink.net>

Phil R Lawrence wrote:
> 
> Malcolm Dew-Jones wrote:
> > Phil R Lawrence (prlawrence@lehigh.edu) wrote:
> > : Geez,  this is so basic...  I want to capture 'http://' in $1. 
> > : What am I doing wrong?
> >
> > :    DB<1> $url = 'http://www.lehigh.edu/foo'
> > :    DB<2> $url =~ s{^(.*//)}{}
> > :    DB<3> print $1
> > :    DB<4> print $url
> > : www.lehigh.edu/foo
> >
> >       $url = 'http://www.lehigh.edu/foo';
> >       $url =~ s{^(.*//)}{};
> >       print $1;
> >       print $/; # add line break
> >       print $url;
> >
> > works for me as a script.  perhaps the debugger is not.
> 
> Yep.  Can someone explain what scope issue is going on between
> debugger lines?

Each debugger line is run in it's own scope.  This, in turn, limits the
scope of the regex capture variables.


-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.  

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 V10 Issue 4711
***************************************


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