[11590] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5190 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 21 07:07:45 1999

Date: Sun, 21 Mar 99 04:00:19 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 21 Mar 1999     Volume: 8 Number: 5190

Today's topics:
    Re: access to unparse command line (Ronald J Kimball)
    Re: Apache Win98 CGI.pm problems <gellyfish@btinternet.com>
    Re: attaching email files <gellyfish@btinternet.com>
    Re: difference between my $x = 1 and my $x; $x = 1 <skilchen@swissonline.ch>
        Do you know how to install perl on a win95 system? (Andri Bell [aka Andre Bell])
    Re: Do you know how to install perl on a win95 system? <sfaust@isi-mtl.com>
    Re: Environment strings (Ronald J Kimball)
    Re: Form submission for football tipping (Ronald J Kimball)
    Re: Form submission for football tipping <gellyfish@btinternet.com>
    Re: Help please - can't open .pl file (Ronald J Kimball)
    Re: Help please - can't open .pl file <horizon@internetexpress.com.au>
    Re: Help please - can't open .pl file <gellyfish@btinternet.com>
    Re: Ms-Mail from perl brandtr@my-dejanews.com
    Re: Need Faster Approach (Ronald J Kimball)
    Re: Need Faster Approach (Ronald J Kimball)
    Re: Print to browser before end of script (Ronald J Kimball)
    Re: Print to browser before end of script <gellyfish@btinternet.com>
    Re: Problems sorting arrays correctly <gellyfish@btinternet.com>
    Re: Q: How do i? <gellyfish@btinternet.com>
    Re: Q: opening multiple filehandles concurrently? (Ronald J Kimball)
    Re: RAD or WYSIWIG for Perl ??? <sfaust@isi-mtl.com>
    Re: Regex Question (Ronald J Kimball)
    Re: Regex Question <gellyfish@btinternet.com>
    Re: Sending to multiple recipients via Sendmail <gellyfish@btinternet.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sun, 21 Mar 1999 02:10:51 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: access to unparse command line
Message-Id: <1dozrzg.9dnr0rrxxw06N@[207.60.170.22]>

<kk> wrote:

> Anyone know of way to access the unparsed command line arguments (something
> instead of @ARGV)?

I assume you mean you want access to the command line arguments prior to
the command shell doing filename globbing and what-not.

Sorry, but that's not possible.  It would require cooperation from the
command shell, and command shells don't do that.

-- 
#!/usr/bin/sh -- chipmunk (aka Ronald J Kimball)
      perl -e'for(sort keys%main::){print if $$_ eq 1}
            ' -s  -- -' Just' -' another ' -'Perl ' -'hacker
' http://www.tiac.net/users/chipmunk/ [rjk@linguist.dartmouth.edu]


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

Date: 21 Mar 1999 10:09:39 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Apache Win98 CGI.pm problems
Message-Id: <7d2gh4$5hi$1@gellyfish.btinternet.com>

On Sun, 21 Mar 1999 08:08:42 +0700 Robert White wrote:
> No cookies, for one thing.
> No SSI for another.
> I have 3 different virtual domains going with various Options set
> in a standalone setup and it won't go.
> .pl and .cgi scripts run ok.
> Have run out of clues  :-((

Sorry, didnt quite catch the Perl question old chap.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 21 Mar 1999 11:17:13 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: attaching email files
Message-Id: <7d2kfp$5lj$1@gellyfish.btinternet.com>

On Sun, 21 Mar 1999 06:37:46 GMT billy_collins@my-dejanews.com wrote:
> Hi,
> 
> Will appreciate if someone could tell me if there is a freely available script
> for the following, or if not, then what modules would come in handy:
> 
> I need to set a simple form, giving the user a facility to send a file as an
> attachment to an email address. I think that to allow the user to select the
> file to attach from his computer, I would need the MULTIPART form, but how to
> send it as an attachment with the email?
> 

If you are using the module CGI.pm (as recommended by 9 out of 10 Perl 
breeders) then you can use the file upload facilities as described in the
most excellent documentation for that module and in various other places.

To create the E-Mail attachments you can use the Mime-Tools package available
from CPAN and Roberts your avuncular relative as they say...

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 21 Mar 1999 09:11:20 +0100
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: difference between my $x = 1 and my $x; $x = 1
Message-Id: <7d29rk$jot$1@online-15-atm.cablecom.ch>

I asked in message <7cnb2o$82g$1@online-15-atm.cablecom.ch>...
>Where can i find a description of the semantic difference between
>a) my $x = something;
>and
>b) my $x; $x = something;
>

Thanks for all the enlightening replys via mail and news. As somebody
pointed out, i missed a relevant part of the paragraph "private variables
via my()" in perlsub.pod :
  The declared variable is not introduced (is not visible) until
  after the current statement.
  ...

btw. probably i will never get a real understanding of the "magic" involved
in seemingly simple things like "assignment". The difficult part is now to
understand, why my silly examples work, if i predeclare the my variable. Is
the following a usable illustration of what actually happens:
sub my_fact {
  my $n = shift;
  my $helper;
  {
    my $helper1 = sub {
      my $n = shift;
      return ($n == 0) ? 1 : $n * &$helper($n - 1);
    };
    $helper = $helper1;
  }
  return &$helper($n);
}

Another question:
Is it true, that one should not use anonymous internal helper functions, if
the enclosing subroutine is called many times?
It seems that the anonymous sub stored in $helper1 and then assigned to
$helper is "compiled" every time my_fact is called (and therefore a lot of
garbage is produced).

--
Samuel Kilchenmann
skilchen@swissonline.ch




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

Date: Sun, 21 Mar 1999 07:28:45 GMT
From: andre_perl@ONE-CLICK.COM (Andri Bell [aka Andre Bell])
Subject: Do you know how to install perl on a win95 system?
Message-Id: <7d2e8a$epu@dfw-ixnews12.ix.netcom.com>

I know this may seem like a basic question to most of you, but at this time 
it's complex to me (a dude who's ftp'd and configured hundreds of perl scripts 
to existing unix servers but never installed perl itself because it was 
already there).

I would now like to install perl onto a win95 system and am having a little 
bit of a challenge and hope you can help me or point me to a resource 
that can help.

I've unzipped perl and installed it using the install.bat file. I can access 
perl.exe and its functions from the command line, I just can't get it to work 
within my win95 intranet. I mainly get 501 errors.

Another error that pops up is when I try to set permissions the system says 
chmod is an 'unrecognized command'. This tells me I've missed a step 
somewhere since chmod is either a standalone executable that I can't find on 
my server or part of the environment of perl that I incorrectly setup. Either 
way I'm missing some step(s).

Perl is already in my path so I know that's not the issue here. Maybe I also 
need to add perl to my win95 environment somehow??? I'm just guessing 
though...

If you know what I've missed please let me know. 

Thanks!

Andre'


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

Date: Sun, 21 Mar 1999 04:49:40 -0500
From: "S.Faust" <sfaust@isi-mtl.com>
Subject: Re: Do you know how to install perl on a win95 system?
Message-Id: <1a3J2.5$ay6.15@weber.videotron.net>

http://www.ActiveState.com/

click  the install and that is it

Andri Bell [aka Andre Bell] wrote in message
<7d2e8a$epu@dfw-ixnews12.ix.netcom.com>...
>I know this may seem like a basic question to most of you, but at this time
>it's complex to me (a dude who's ftp'd and configured hundreds of perl
scripts
>to existing unix servers but never installed perl itself because it was
>already there).
>
>I would now like to install perl onto a win95 system and am having a little
>bit of a challenge and hope you can help me or point me to a resource
>that can help.
>
>I've unzipped perl and installed it using the install.bat file. I can
access
>perl.exe and its functions from the command line, I just can't get it to
work
>within my win95 intranet. I mainly get 501 errors.
>
>Another error that pops up is when I try to set permissions the system says
>chmod is an 'unrecognized command'. This tells me I've missed a step
>somewhere since chmod is either a standalone executable that I can't find
on
>my server or part of the environment of perl that I incorrectly setup.
Either
>way I'm missing some step(s).
>
>Perl is already in my path so I know that's not the issue here. Maybe I
also
>need to add perl to my win95 environment somehow??? I'm just guessing
>though...
>
>If you know what I've missed please let me know.
>
>Thanks!
>
>Andre'




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

Date: Sun, 21 Mar 1999 02:10:54 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Environment strings
Message-Id: <1dozs7e.wummw817r1xx1N@[207.60.170.22]>

Bret Bordwell <bret@bordwell.com> wrote:

> Does anyone know of problems with the environment strings being kept
> and re-used after the process has finished running?
> 
> I know, that sounds real cryptic...  here's my problem:
> 
> I'm writing an E-Mail game using HTML with two list selects, and a
> submit btn.
> After parsing the form, and getting the 'post'ed vars, everything goes
> smoothly.  
> Subsequent plays made one after the other (I'm playing the game with
> myself), appears
> to use the previous 'post'ed strings, ignoring what was actually passed
> in.
> 
> Assuming it's not my code, then the only logical thing left is what was
> described above.

In that case, it must be your code.  Environment variables simply don't
work that way.


Perhaps it's an error on line 17?

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sun, 21 Mar 1999 02:10:59 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Form submission for football tipping
Message-Id: <1dozsat.c8uyz0psjx86N@[207.60.170.22]>

chris <candree@one.net.au> wrote:

> Recently I had the great idea to start an on-line football tipping
> competition with a few friends.  My friends can log on to the page, pick the
> teams that they think are going to win on the weekend, and then submit the
> form.  Once all forms have been submitted, I would like to view a report of
> a)  who has submitted a form and b) what teams they picked to win?
> 
> For example the form could have a check box beside each team:
> 
> Essendon  vs Carlton *
> Geelong vs North Melbourne*                    (* = a ticked check box)
> Melbourne*  vs Richmond
> Brisbane*  vs St Kilda

Perhaps those should be radio buttons, in pairs, to enforce selecting
one team for each game.

> So after I have submitted the above form a report would be generated stating
> that I had picked Carlton, North Melbourne, Melbourne and Brisbane to win.
> The finished report would contain all names of people who submitted a form
> and the teams that they picked to win.
> 
> As I am a complete newbie to CGI scripts and Perl can anyone explain to me
> how a cgi script would process this information and present it as a report?
> Can anyone suggest an algorithm that would help me process the submitted
> form? (any code would be greatly appreciated!!!!)

Using the CGI.pm would make this much simpler, as opposed to writing all
the CGI specific code yourself.  You would handle parsing the form
submission with that module.

Then, you would format the submission, and add it to a database file you
keep with the CGI script.  You might use a format like:

  John Doe|Carlton|North Melbourne|Melbourne|Brisbane

And then you would just append that line to the database file.


Getting the overall report would be a separate operation.  You'd read in
the entire file, and analyse and format the data however you liked.  For
example, you could do a straightforward table:

  John Doe     Carlton     North Melbourne     Melbourne     Brisbane
  Bob Johnson  Essendon    Geelong             Melbourne     St Kilda

And you could tally votes for each time:

  Carlton          11
  Essendon          6
  North Melbourne  12
  Geelong           5
  Melbourne         8
  Richmond          9
  Brisbane         10
  St Kilda          7

And whatever else you wanted to do.


Anyway, I think what you really want to do is take some time to get
started on learning Perl, take a crack at the script, and then ask more
questions if you get stuck.


-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 21 Mar 1999 11:03:40 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Form submission for football tipping
Message-Id: <7d2jmc$5l9$1@gellyfish.btinternet.com>

On Sun, 21 Mar 1999 12:44:31 +1000 chris wrote:
> Hi everyone.
> 
> Recently I had the great idea to start an on-line football tipping
> competition with a few friends.  

And whats wrong with the tried and tested method of 'bunging' large
sums of money in a brown paper bag at a motorway service station at
midnight .. or is that not what you meant ;-}

Use the module CGI.pm to deal with all of the CGI stuff and the form
generation.  You will probably want to keep two data files, one which
contains the fixtures and one which contains people prognostications.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 21 Mar 1999 02:11:00 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Help please - can't open .pl file
Message-Id: <1dozsve.zjlzdv1bhrcrvN@[207.60.170.22]>

Mark Austin <austin.m@virgin.net> wrote:

> All auto-installed ok but when I double click on any of the .pl files, the
> Perl scripting screen flashes up and then off again in a split second (you
> can actually sort of see the script is there).

Try running the Perl scripts from the Windows command line.

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        perl -le 'print "Just another \u$^X hacker"'


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

Date: Sun, 21 Mar 1999 18:44:32 +1100
From: Mick <horizon@internetexpress.com.au>
To: Mark Austin <austin.m@virgin.net>
Subject: Re: Help please - can't open .pl file
Message-Id: <36F4A360.EACC7A7E@internetexpress.com.au>

Dos prompt try -
perl wwwboard.pl

If it is intended for the Web, and you want to test it, you must have a web
server running that is configured to execute perl scripts, then place the perl
script in the appropriate directory and point your browser at it!

*NOTE* - If it was written for unix you may need to alter the first line #!
to point to your perl.exe

Mick

Mark Austin wrote:

> Need to incorporate a Perl / CGI script for my web-site.
> Got a freeware script (wwwboard.pl) that is near perfect but need to make a
> few amendments (the author states this is allowed).
> WWWboard was written for unix and I will be hosting it on a unix server
> site.
> Downloaded the latest version (5. something) of Perl and the Microsoft fix
> thing they say necessary (I'm using Win95).
> All auto-installed ok but when I double click on any of the .pl files, the
> Perl scripting screen flashes up and then off again in a split second (you
> can actually sort of see the script is there).
> Also tried clicking on the Perl.exe file to get the scripting window up
> (which worked) and then cut and pasted the script via Notepad - only the
> first few lines came out.
>
> Any ideas (plain English and non-profane preferred!).
>
> Mark



--
----------------------------------------------------------------
HORIZON Software Solutions

Visit Site - http:www.deakin.edu.au/~bellears/horizon/index.html
e-mail     - mailto:horizon@internetexpress.com.au

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




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

Date: 21 Mar 1999 10:52:17 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Help please - can't open .pl file
Message-Id: <7d2j11$5l4$1@gellyfish.btinternet.com>

On Sun, 21 Mar 1999 18:44:32 +1100 Mick wrote:
> 
> *NOTE* - If it was written for unix you may need to alter the first line #!
> to point to your perl.exe
> 

Depending on the server that might be a red herring - Some servers might
*emulate* the Unix behaviour in that respect but it is by no means the most
common method. But that would be a question for another group.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 21 Mar 1999 07:40:18 GMT
From: brandtr@my-dejanews.com
Subject: Re: Ms-Mail from perl
Message-Id: <7d27p2$sn0$1@nnrp1.dejanews.com>

Dan,  I used a pipe to Sendmail for sending mail on my companies (unix) web
site. When the company converted to MS-Exchange mail, my mail gateways quit
working. I converted all my Perl scripts (mail gateways) to use the
Mail::Sendmail Perl module and everything started working again.  I don't
completely understand why but it has to do with MX records.  The MS-Exchange
mail server is mail.domain.com but the email addresses are
firstname.lastname@domain.com . domain.com does mot have a SMTP port but the
MX records, I think, direct the mail to mail.domain.com. If anyone has a
better explaination I would be interested in hearing it.

In article <7cs776$d0i$1@news.NERO.NET>,
  Dan Sugalski <sugalskd@netserve.ous.edu> wrote:
> massimobalestra@my-dejanews.com wrote:
> : Hi, Does somebody knows if there is a way to send a mail Through a server
> : Microsoft Mail (Ms-Mail) without having a gateway? Or  (Off Topic) does
> : exists there a (freeware) gateway from unix to ms-mail?
>
> : I know perl and unix but not ms-mail server.
>
> Does the MSMail server do SMTP? If so, you can always connect to it and
> send mail directly. If not, you could always see about sneaking a linux
> box in there somewhere... :)
>
> 					Dan
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Sun, 21 Mar 1999 02:11:01 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Need Faster Approach
Message-Id: <1dozt7e.929gvq115hw3sN@[207.60.170.22]>

Jay Glascoe <jglascoe@giss.nasa.gov> wrote:

> $string = join ",", (1..100000);
> 
> @foo = split /,/, $string, 75_051;
> @biz = @foo[-50 .. -1];
> 
> print "@biz\n";

Woops....  The last element of @biz will be a single string containing
elements 75051 to 100000.


$string = join ",", (1..100000);

@foo = split /,/, $string, 75_051;
pop @foo;
@biz = @foo[-50 .. -1];

print "@biz\n";


-- 
chipmunk (Ronald J Kimball) <rjk@linguist.dartmouth.edu>
perl -e 'print map chop, sort split shift, reverse shift
' 'j_' 'e._jP;_jr/_je=_jk{_jn*_j &_j :_j @_jr}_ja)_js$_j
~_jh]_jt,_jo+_jJ"_jr>_ju#_jt%_jl?_ja^_jc`_jh-_je|' -rjk-


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

Date: Sun, 21 Mar 1999 02:11:03 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Need Faster Approach
Message-Id: <1doztnr.1phdgcqdb7ex5N@[207.60.170.22]>

Earl Hood <ehood@medusa.acs.uci.edu> wrote:

> >> Have looked into using index()/rindex()?
> 
> >How would one use either of those functions effectively to find the 
> >75,000th item in a comma-delimited string, as requested?  Looping 
> >through 75000 index() calls to find the 75,000th comma sounds like a
> >*very* costly procedure.
> 
> What do you think split does internally?
> 
> The first obvious advantage of using index() is that you save memory by
> avoiding building a large list structure.
> 
> As for speed, one needs to determine if the apparent "extra" work going
> into using an index() approach is faster or slower than the overhead
> that a basic split() approach has building a list with many elements.
> 
> Of course, using Benchmark will help determine the fastest approach,
> and I leave that as an exercise for the reader :-)

I'll be that reader...  :)


I compared my solution, using index() to find the appropriate point and
then splitting the substr(), versus the straightforward split() of the
entire string.

#!perl

use strict;
use Benchmark;

my $str = '1';
my $i;
for ($i=2;$i<=100_000;++$i) {
  $str .= ",$i";
}

sub index_ {

    my $pos = 0;
    my $count = 0;

    $pos = index($str, ',', $pos) + 1
        while (++$count < 75_000 and $pos >= 0);

    my @records;

    if ($pos > 0) {
        @records[0..49] = split(/,/, substr($str, $pos), 51);
    }

}

sub split_ {

    my @cols = split /,/, $str, 75_051;
    pop @cols;
    my @records = @cols[-50 .. -1];

}

timethese( 1 << shift || 0, {
    'index' => \&index_,
    'split' => \&split_,
});

__END__

Benchmark: timing 16 iterations of index, split...
     index:  8 secs ( 7.24 usr  0.02 sys =  7.26 cpu)
     split:  9 secs ( 9.17 usr  0.15 sys =  9.32 cpu)


As you can see, both solutions are rather slow; about a half-second for
a single iteration.  But the index() solution has an edge over the
split() solution, presumably due to the overhead of allocating a 75,051
element array.


perl5.004_04, using perl's malloc.

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
perl -e 'for(@ARGV){require $_;print "$_\n  $INC{$_}\n"}' Benchmark.pm


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

Date: Sun, 21 Mar 1999 02:11:04 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Print to browser before end of script
Message-Id: <1dozu4w.1w0hv28wyufwuN@[207.60.170.22]>

Mike Clark <super@super-mall.net> wrote:

> I am writing a script which receives values from a form, then passes the
> values to a number of command lines which execute a series of other programs
> in sequence.
> 
> The whole process takes several minutes.
> 
> After the viewer submits the form, I want the script to print to browser
> "thanks, please wait" or some message.
> 
> But the script waits until all the processes are finished before it prints
> to browser, and the browser times out.

close(STDOUT) as soon as you're done printing to it.  That should let
the browser know that all data has been received, and it can display
what it got.

If that doesn't work, you may need to fork off a separate process to
handle the execution of the other programs.

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
perl -e'$_="\012534`!./4(%2`\cp%2,`(!#+%2j";s/./"\"\\c$&\""/gees;print'


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

Date: 21 Mar 1999 11:07:44 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Print to browser before end of script
Message-Id: <7d2ju0$5lc$1@gellyfish.btinternet.com>

On Sun, 21 Mar 1999 02:11:04 -0500 Ronald J Kimball wrote:
> 
> If that doesn't work, you may need to fork off a separate process to
> handle the execution of the other programs.
> 

If you fork() off processes to do the dirty work it is necessary to close
the STDOUT on those as well (or close STDOUT before fork()ing).

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 21 Mar 1999 11:25:20 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Problems sorting arrays correctly
Message-Id: <7d2kv0$5m7$1@gellyfish.btinternet.com>

On Sun, 21 Mar 1999 02:22:35 +0100 Asbjorn Gjemmestad wrote:
> 
> Andrew Johnson skrev i meldingen ...

<snipped Andrew's perfectly good solution>

> 
> What I want it to do is simply sort everything with highest number first for
> all elements, and correct alphabetically order. I though I'd done that when
> sorting and reversing, but when the first numbers (the numbers before the
> first |) are the same, it goes over to just plain alphabetically order.
> 

The solution that Andrew gave is a perfectly good solution to what you want
there is no way to sort on this way without first splitting up the input
into its constituent components.  In the code that you posted anyhow you were
using the <=> operator which is a numerical comparison which will only
take into account anything up to the first non-numeric character - so you
will only have got the sort on the first column.

If I were you I would try Andrews solution out because it does work ...

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 21 Mar 1999 11:28:26 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Q: How do i?
Message-Id: <7d2l4q$5ma$1@gellyfish.btinternet.com>

On Sun, 21 Mar 1999 04:07:21 GMT ramzes@my-dejanews.com wrote:
> 
> 
>> I have a little problem. Now I'm trying to write search engine for my site
> can you explain what does this mean, "my site"?
> ;)
> 

Can you explain why you posted this non-answer nearly two weeks after the
original post ?  

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 21 Mar 1999 02:11:05 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Q: opening multiple filehandles concurrently?
Message-Id: <1dozudt.1dsb1bg1ppmrnfN@[207.60.170.22]>

Larry Rosler <lr@hpl.hp.com> wrote:

> > > Is it possible to have more than one filehandle open concurrently?
> > 
> > yes.  you even start off with a couple open already :)
> 
> New definition of 'a couple' -- three?  I thought that was a 'crowd'.
> ;-)

Not a new definition.  'couple' can mean 'an indefinite small number' or
'few' in addition to 'two'.

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sun, 21 Mar 1999 04:51:40 -0500
From: "S.Faust" <sfaust@isi-mtl.com>
Subject: Re: RAD or WYSIWIG for Perl ???
Message-Id: <Vb3J2.6$ay6.143@weber.videotron.net>

thereis some here http://www.ActiveState.com/
but they are quite pricy

Jonathan Stowe wrote in message <7d13ek$4s7$1@gellyfish.btinternet.com>...
>On Wed, 17 Mar 1999 01:29:57 -0500 Steve Davis wrote:
>>
>> I want a GUI that will help me assemble the code.. there are dozens of
apps
>> out there to help me produce java apps but nothing for Perl which
surprises
>> me.
>>
>> I am clueless when it comes to writing perl from scratch and I think a
GUI
>> or RAD product for Perl is long overdue.
>>
>
>O come on Perl just doesnt work like that - there is no 'application
>framework' you just have to pick up your editor and type - I had a quick
>thought abought making a spoof drag and drool thing here but I got bored.
>
>Learn perl, learn to use a good text editor, use your brain and enjoy
>being a genius ...
>
>/J\
>--
>Jonathan Stowe <jns@btinternet.com>
>Some of your questions answered:
><URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
>Hastings:
<URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>




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

Date: Sun, 21 Mar 1999 02:11:07 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Regex Question
Message-Id: <1dozugz.1k8sre02g4j9uN@[207.60.170.22]>

Gene Wilburn <gwilburn@home.com> wrote:

> $i = 0;
> foreach $line (@thiscal) {
> 
>     chop $line;
> 
>     # Stuff each value into the cal array, including
>     # the blank days as imagemap placemarkers
>     
>     $line =~ /(..) *(..) *(..) *(..) *(..) *(..) *(..)/;
>     $cal[$i++] = $1 if $1;
>     $cal[$i++] = $2 if $2;
>     $cal[$i++] = $3 if $3;
>     $cal[$i++] = $4 if $4;
>     $cal[$i++] = $5 if $5;
>     $cal[$i++] = $6 if $6;
>     $cal[$i++] = $7 if $7;
> }

Ick.

foreach $line (@thiscal) {

  push @cal, $line =~ /(..) ?/g;

}


-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
perl -e'$_="\012534`!./4(%2`\cp%2,`(!#+%2j";s/./"\"\\c$&\""/gees;print'


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

Date: 21 Mar 1999 10:48:39 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Regex Question
Message-Id: <7d2iq7$5l1$1@gellyfish.btinternet.com>

On Sun, 21 Mar 1999 02:43:10 GMT Gene Wilburn wrote:
> I'm writing a Perl script to snork in the contents of Unix cal to create
> a calendar array in my program. I'm hitting a snag. My regular
> expression doesn't work if the line is less than seven days long. I.e.:
> 
<snip>
>     
>     $line =~ /(..) *(..) *(..) *(..) *(..) *(..) *(..)/;
<snip>
> 
> Everything works fine if cal has a full line, but when it's short of a
> week, my regex fails. Is there a way to construct a regex that works if
> there's less than a full-line match? I thought the * would do it, but
> obviously not.
> 

Well the problem is trying to use a regular expression to do something
that is probably best done by other means.  That other means in this 
instance is probably split().

I'm not entirely sure what it is that you are doing here but just for fun
here is my take on it (gotta prove I didnt wipe my brain out with beer last
night :) - It takes the 'cal' output and places it in a two dimensional array
padding as appropriate ( I have used '*'s to see what is going on but you
might want to use something else):


#!/usr/bin/perl -w

use strict;

my $month = $ARGV[0];
my $year  = $ARGV[1];

my $command = "/usr/bin/cal $month $year";

my @cal = ();

chomp(my @thiscal = `$command`);

splice @thiscal, 0,2;
pop @thiscal;

foreach (@thiscal)
{
  my @days = split;

  if ( $days[0] == 1 )
    {
      while ( scalar @days < 7 )
       {
         unshift @days,"*";
       }
     }
  elsif (  scalar @days < 7 )
    {
       while (scalar @days < 7 )
        {
          push  @days,"*";
        }
    }
  push @cal, \@days;
}

foreach (@cal)
{
  print join (",",@{$_}),"\n";
}


/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 21 Mar 1999 11:13:35 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Sending to multiple recipients via Sendmail
Message-Id: <7d2k8v$5lg$1@gellyfish.btinternet.com>

In comp.lang.perl.misc Glen Lee Edwards <GLEdwards@christianfamilies.net> wrote:
> I have a small mailing list, about 25, that I use from a mailing program I
> wrote.  Currently I am closing the pipe after each letter is sent and then
> reopening it for the next letter.  Is there a way from a PERL program to
> notify Sendmail that one letter is finished and a new one is coming without
> closing and reopening the pipe?
> 

Err no you cant do that.  But why would you want to ? there are other
facilities available to send mail to multiple recipients.  If you are
using sendmail then you could set up an :include: file in your aliases file
or alternativley you could just set the Bcc: header to a list of the
intended recipients.

If you do want to send each mail individually however (In the case say that
you want to personalise each mail) then you will have to open a pipe to
sendmail for each message send and close it before the next one - that is
how it knows that the message text has ended.  

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5190
**************************************

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