[7404] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1029 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 15 20:27:25 1997

Date: Mon, 15 Sep 97 17:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 15 Sep 1997     Volume: 8 Number: 1029

Today's topics:
     Re: &&/|| vs. and/or (dave)
     about using 'require' with NT <yinso@u.washington.edu>
     Attempt to free unreferenced scalar?? (Ken Williams)
     Re: automatically generating regex patterns <hakank@kajen.com>
     Re: Bad start on Win95 (Eric Bohlman)
     Re: Comparing dates?? <rbush@up.net>
     does \1 \2 \3 work? (my mistake is..where..?) (Richard Freytag)
     Re: How to redirect standard output of a backtick comma <sfink@cs.berkeley.edu>
     I'm in an idiom rut ... (dave)
     Re: I'm in an idiom rut ... (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Including common code with 'my' variables (Dan Sumption)
     Re: is there a better way to do this subroutine? (Jeremy D. Zawodny)
     Re: Is there a simpler syntax for: defined $a && $a ne  (Bart Lateur)
     JOB (GraFX-FX)
     Re: local array in subroutine <nysba@ny.ubs.com>
     Re: Perl and WINNT4.0 (Jeremy D. Zawodny)
     Q: locking a dbm-file (Trudno zhit' v derevne bez nagana.)
     questions about 'zap' <dtrobert@ladc.lockheed.com>
     Re: RegExp basics <rbush@up.net>
     Re: Streaming chat mode with Perl running on Win32s. An <Marty@capehatteras.net>
     Re: use LWP::Simple not found? (brian d foy)
     Re: use LWP::Simple not found? (Faust Gertz)
     Re: Username/Password script (Jeremy D. Zawodny)
     Why a three-digit exponential for double precision numb <hawkinsd@email.uah.edu>
     Re: Why don't my <<HERE documents work?  Attempt #2! <jefpin@bergen.org>
     Re: Why don't my <<HERE documents work?  Attempt #2! (Jeremy D. Zawodny)
     Re: Why don't my <<HERE documents work? <v3100411@student.anu.edu.au>
     Re: WWW & Password Access <tou@tou.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 15 Sep 1997 19:31:21 GMT
From: over@the.net (dave)
Subject: Re: &&/|| vs. and/or
Message-Id: <341d8c7a.943941@news.one.net>

Russell Odom <rjo100@york.ac.uk> wrote:

>Is there any difference between using the '&&' and '||' operators as
>opposed to 'and' & 'or'?
>
>Is it just a matter of style (I think 'and'/'or' are nicer to read), or do
>they behave differently under certain circumstances?
>
>I realise you can't do something like '$a or= 1;' rather than 
>'$a ||= 1;' (I do think that's cool, Randal!), are there other
>differences?
>
>TIA,
>
>Russ

Since and/or have less precedence  than &&/||, they are generally
safer when you want precedence to depend on order things are placed on
the line and don't want to use parenthesis.

Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________


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

Date: Mon, 15 Sep 1997 15:01:17 -0700
From: Y Chen <yinso@u.washington.edu>
Subject: about using 'require' with NT
Message-Id: <Pine.OSF.3.96.970915145757.32343A-100000@saul3.u.washington.edu>

Hi,

sorry for the repost, but no one answered my question, I guess it just got
lost in the many emails posted in this newsgroup.  Hope someone gets to
read this email this time :)

I am using NT 4.0 along w/ Website 1.1 and ActiveWare Perl 307.  And
whenever I do a require, it just doesn't want to work w/ the CGI scripts.
I got an error message saying that the cgi doesn't produce an new line to
separate the header and the body.  I wonder if anyone knows what's going
on?  

any help is appreciated.

yin-so			



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

Date: Mon, 15 Sep 1997 17:01:53 -0400
From: ken@forum.swarthmore.edu (Ken Williams)
Subject: Attempt to free unreferenced scalar??
Message-Id: <ken-1509971701530001@news.swarthmore.edu>

Hi-

I'm getting a bizarre error message in my Perl program, and I'm hoping
someone here will be able to help me figure out what it means.  The
message is:

  Attempt to free unreferenced scalar at /forum/taco.dev/lib/io.lib.pl line 315.

When I put debug statements in my code, the error message jumps around
like a slippery fish.  Thus, I can't produce a test program which isolates
the error.

My only guess is that this is some garbage collection thing, but I don't
understand it.

Can anyone tell me what condition makes Perl give this error message? 
What are common causes of it?

Thanks very much in advance.  This bug is causing me much sadness.

-Ken Williams
 The Math Forum
 ken@forum.swarthmore.edu


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

Date: Mon, 15 Sep 1997 23:10:03 +0200
From: Hakan Kjellerstrand <hakank@kajen.com>
To: Snow White <anybody2@nospam.bellsouth.net>
Subject: Re: automatically generating regex patterns
Message-Id: <Pine.LNX.3.95.970915230250.6416A-100000@mother.kajen.com>


[Sorry if you see this in somewhat another form. My newsserver is
somewhat down.]

> 
> Any modules for generating regex patterns from a set of strings?
> 
> NOTE:  I am looking for something more elegant than:
> 
>   str1, str2, str3, str4 "generates" (str1|str2|str3|str4}
> 

I've done a little module (MakeRegex) for this, and handle more advanced
regular expressions than just |-ring the strings. By the way, it is
inspired from emacs' make-regexp, and has the same shortcomings.

The program can be tested (and downloaded) from
http://www.netch.se/~hakank/makeregex 


Hakan Kjellerstrand
hakank@netch.se



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

Date: Mon, 15 Sep 1997 23:17:59 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Bad start on Win95
Message-Id: <ebohlmanEGKopz.8LC@netcom.com>


DJA (1dja@worldnet.att.net) wrote:

: I am trying to teach myself Perl using Win95 and I am off to a slow 
: start. I've loaded the latest self-extracting version from ActiveWare
: and when I try to call a program from a "DOS" window I get a error
: stating "This program cannot be run in DOS mode." When I try to run
: the program from a "PERL" window the program seems to run and the 
: window instantly closes. Where am I going wrong? The FAQ's don't answer 
: this one. (Or I can't see the answer)

What you need to do is create a DOS window that doesn't run in MS-DOS 
mode (aka compatibility mode).  There's a checkbox for that option in the 
"Advanced" dialog off the "Program" tab in the "Properties" entry for the 
DOS window.  That will give you a command line from which you can run Perl.

When you have the "MS-DOS mode" option checked, only true DOS programs, 
not Windows console-mode applications (which Perl is) can run in the 
window.  Also, when you type "exit" in the Window, the Windows 95 shell 
has to be reloaded.  This won't happen with the kind of window I 
described how to create.

Why both types of window?  Some older DOS programs make assumptions about 
memory layout that can't be met by Windows 95's standard multitasking.  
The MS-DOS mode option is there to accommodate those programs.



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

Date: Mon, 15 Sep 1997 17:03:37 -0400
From: "Raymond K. Bush" <rbush@up.net>
To: sb@en.muc.de
Subject: Re: Comparing dates??
Message-Id: <341DA2A9.4AA7@up.net>

Steffen Beyer wrote:
> 
> Burt Lewis <burt@ici.net> wrote:
> 
> > I hope this is simple.
> 
> > I'm capturing birth dates via a form, something like:
> 
> > 09101981 (mmddyyyy)
> 
> > I need to determine if the age of this person is greater than 18.
> 
> > Anyone have any routines or ideas on the best and easisest way to do this?
> 
> That's relatively easy:
> 
> -------------------- cut here -------------------- cut here --------------------
> #!/sw/bin/perl
> 
> use Date::DateCalc qw(:all);
> use Date::DateCalcLib qw(:all);
> 
> print "\n";
> 
> $ok = 0;
> while (! $ok)
> {
>     print "Please enter the date of your birthday (month-day-year): ";
>     $date = <STDIN>;
>     print "\n";
>     if (($yy1,$mm1,$dd1) = decode_date_us($date))
>     {
>         $datestr = date_to_short($yy1,$mm1,$dd1);
>         print "Your birthday is: $datestr\n";
>         print "\n";
>         print "Is that correct? (yes/no) ";
>         $response = <STDIN>;
>         print "\n";
>         $ok = ($response =~ /^Y/i);
>     }
> }
> 
> print "Your birthday is: $datestr\n\n";
> 
> ($yy2,$mm2,$dd2) = parse_date(`/bin/date`); # get today's date

                                ^^^^^^^^^^
I was digggin this till i hit this line.  This is the slowest 
most inneficient way i can think to get a date in a script
other than typing it in. Make that server work! I still like ctime.pl
for getting dates.  It's much faster. Run a loop with 2000 of each
an you will see what i mean.

> 
> if (($mm1 == 2) && ($dd1 == 29) && !check_date($yy2,$mm1,$dd1)) { $dd1--; }
> 
> if ( (($yy2 - $yy1) >  18) ||
>    ( (($yy2 - $yy1) == 18) &&
>     (dates_difference($yy2,$mm1,$dd1,$yy2,$mm2,$dd2) >= 0) ) )
> {
>     print "Ok - you are over 18.\n";
> }
> else
> {
>     print "Sorry - you aren't 18 yet!\n";
> }
> 
> print "\n";
> 
> -------------------- cut here -------------------- cut here --------------------
> 
> Note that you can enter the date in almost any format this way as long as
> the order of the three items is month - day - year!
> 
> For instance you can use numbers for the month or an abbreviation of the
> month's name (like "jan", "feb" etc.) - that's up to the user!
> 
> You can find this module ("DateCalc-3.2.tar.gz") on any CPAN ftp server
> or on my web site at
> 
> http://www.engelschall.com/u/sb/download/
> 
> Hope this helps.
> 
> Yours,
> --
>     Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
>      "There is enough for the need of everyone in this world,
>       but not for the greed of everyone." - Mahatma Gandhi
>    >> Unsolicited commercial email goes directly to /dev/null <<

-- 
--Ray
 .70~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~07.
      --- reply to rbush - at - up - dot - net ---
--- please include indication of past correspondence ---
      --- in order to receive a faster response ---


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

Date: Mon, 15 Sep 1997 19:19:59 -0400
From: broken-to-avoid-junkmail-remove-this-freytag@remove.me.too.freytag.org (Richard Freytag)
Subject: does \1 \2 \3 work? (my mistake is..where..?)
Message-Id: <broken-to-avoid-junkmail-remove-this-freytag-ya023580001509971919590001@news.jic.com>
Keywords: perl pattern matching regexp

Riddle me this Perlers, 

There is an easy way to do match multiple vowels but I decided to use
the memory capability of the () in a match to be tricky.  Therefor I
stumbled on the following problem....

Run the following and you should see that the vowels get pulled out
of _all_ the example strings and matched.  But in the last 6 cases
they don't; please why?

#!/usr/local/bin/perl -w

print "\n\n\nStarting script\n";

$consonants = "bcdfghjklmnpqrstvwxyz";

print "\nEnter words on several lines and this script should return those
that contain 3 vowels:";
#chomp( @lines = <STDIN>);
chomp( @lines = ( "aei", "babebib", "bbabbebbibb", "aaei", "aeei", "aeii",
"bbaabbebbibb", "bbabbeebbibb", "bbabbebbiibb"));
foreach ( @lines){
   print "\n";
   print;
}

print "\n\nParsing lines:\n"; 
foreach (@lines){
 print "\n\n"; print;
   if(
m|^(?:[$consonants])*([aeiou])(?:[$consonants\1])*([^consonants\1])(?:[$cons
onants\1\2])*([^consonants\1\2])(?:[$consonants\1\2\3])*$|i){
      print "\nm "; print;
    print "\n$1 $2 $3 $4 $5";
   }
}

print "\n\n\n\nEnd of script.\n";


Here is a longer example for 4 vowels that breaks down completely....

#!/usr/local/bin/perl -w

print "\n\n\nStarting script\n";

$consonants = "bcdfghjklmnpqrstvwxyz";

print "\nEnter words on several lines and this script should return those
that contain 4 vowels:";
#chomp( @lines = <STDIN>);
chomp( @lines = ( "aeio", "babebibob", "bbabbebbibbobb", "aaeio", "aeeio",
"aeiio", "aeioo", "bbaabbebbibbobb", "bbabbeebbibbobb", "bbabbebbiibbobb",
"bbabbebbibboobb"));
foreach ( @lines){
   print "\n";
   print;
}

print "\n\nParsing lines:\n"; 
foreach (@lines){
 print "\n\n"; print;
   if(
m|^(?:[$consonants])*([aeiou])(?:[$consonants\1])*([^consonants\1])(?:[$cons
onants\1\2])*([^consonants\1\2])(?:[$consonants\1\2\3])*([^consonants\1\2\3])
(?:[$consonants\1\2\3\4])*$|i){
      print "\nm "; print;
    print "\n$1 $2 $3 $4 $5";
   }
}

print "\n\n\n\nEnd of script.\n";


Again, thank you very much for looking over my shoulder and telling me
where I'm going wrong.

Cheers,
Richard Freytag
[Skyline Soaring Club, New Market, VA]


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

Date: Mon, 15 Sep 1997 14:10:35 -0700
From: Steve Fink <sfink@cs.berkeley.edu>
To: Pierre BERGDOLT <Pierre.Bergdolt@ansf.alcatel.fr>
Subject: Re: How to redirect standard output of a backtick command
Message-Id: <341DA44B.7971@cs.berkeley.edu>

1: exec("cmd") if (fork() == 0);
2: open(CMD,"cmd|") or die; do(\@other,$stuff); print <CMD>; close(CMD);

(depends on exactly what you want)


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

Date: Mon, 15 Sep 1997 19:39:59 GMT
From: over@the.net (dave)
Subject: I'm in an idiom rut ...
Message-Id: <341d8d81.1206482@news.one.net>

Hi,

I have found that I like passing key/value pairs to programs and
subroutines a lot.  The way I pull the pairs off the passed flat list
is fastly becomming always the same thing:

while( @_ > 0 )
{
    last unless defined $_[1];
    $hash{$_[0]} = $_[1];
    shift; shift;
}

Just wondering if I could have less typing with the same
functionality, without writing a "getargs" subroutine.


Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________


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

Date: Mon, 15 Sep 97 18:21:06 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: I'm in an idiom rut ...
Message-Id: <341db520$1$ofn$mr2ice@speaker.kf8nh.apk.net>

In <341d8d81.1206482@news.one.net>, on 09/15/97 at 07:39 PM,
   over@the.net (dave) said:
+-----
| while( @_ > 0 )
| {
|     last unless defined $_[1];
|     $hash{$_[0]} = $_[1];
|     shift; shift;
| }
| Just wondering if I could have less typing with the same
| functionality, without writing a "getargs" subroutine.
+--->8

Have you tried

    %hash = @_;

?

-- 
brandon s. allbery              [Team OS/2][Linux]          bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)           FORZA CREW!
Warpstock '97:  OS/2 for the rest of us!  http://www.warpstock.org



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

Date: Mon, 15 Sep 1997 22:22:46 GMT
From: dan@gulch.demon.co.uk (Dan Sumption)
Subject: Including common code with 'my' variables
Message-Id: <341db2e8.9914906@news.demon.co.uk>

Can anyone suggest a way of replacing common blocks of code in a
subroutine, when those blocks contain lexical (my) variables.

For example, many classes I will use a block such as:

   my $name = &::globalswap_in('name', $self->name);
   my $description = &::globalswap_in('description',
	$self->description);

But for some subclasses I may want to substitute this with:

   my $name = &::globalswap_in('name', &htmlise($self->name));
   my $description = &::globalswap_in('description',
	&htmlise($self->description));

While keeping the remainder of the subroutine the same.

(don't take this example too literally - I will want to use more
complex alternatives in some cases).

In effect what I want to do is call a subroutine which passes its 'my'
variables to the parent subroutine, so that they only go out of scope
at the end of the parent block.

I don't think that I can do this using an eval, because then the my
variables would be restricted to the scope of the eval (and even if
this were possible, I don't know that it would be the most desirable
way).

Does anyone have any idea whether/how this can be done?


Dan Sumption, Technical Director        dan@gulch.demon.co.uk
Hard Reality, Canary Wharf, London E14  dan@hardnet.co.uk

http://www.hardnet.co.uk/dan/


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

Date: Mon, 15 Sep 1997 21:05:39 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: is there a better way to do this subroutine?
Message-Id: <341fa2db.377729436@igate.hst.moc.com>

[cc'd automagically to original author]

On Mon, 15 Sep 1997 15:45:39 -0400, "Raymond K. Bush" <rbush@up.net>
wrote:

>> I'll say it right here. :-)  Don't use a typeglob if you can use a
>> reference instead. References are better in every way: faster, more
>> reliable, more efficient, easier to understand, tastes great, less
>
>I dont think references are easier to understand ... I think that's a
>subjective thing.
>Now as for speed yes its faster. I put a call in a loop and waited. 
>Then did the same for 
>a reference version. I did see ssome obscure mention in the FAQ about
>speed but nothing else ... 
>if it's such an issue why isnt it there?

Have a look at "Advanced Perl Programming", published by O'Reilly &
Associates. The first few chapters go a long way toward where Tom is
headed with his comments, I believe.

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Mon, 15 Sep 1997 22:46:17 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Is there a simpler syntax for: defined $a && $a ne ''
Message-Id: <341eb735.6130014@news.tornado.be>

Andrew Johnson <ajohnson@gpu.srv.ualberta.ca> wrote:

>> Russell> $a = 1 if $a eq '';
>
>that would give an 'uninitialized' warning under -w 
>if $a was not defined.

That's only a warning, not an error.

If it annoys you (it clutters your output, hiding really interesting
warnings), you can temporarily disable warnings by clearing $^W:

	#perl -w
	print $xyz;
	{
		local($^W);
		print $xyz;
	}
	print $xyz;

You'll get a warning for the first and the last statement, but not for
the statement inside the block.

HTH,
Bart.


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

Date: Mon, 15 Sep 1997 22:30:28 GMT
From: webgrafx@webgrafx-fx.com (GraFX-FX)
Subject: JOB
Message-Id: <341fb6f8.4362772@news.buffnet.net>

Hi..

I am looking for a cgi/perl programmer to set up a few routines for me
for cash payment for services rendered. 

The most important routine I wish to contract for is:

Way to manipulate a 7000+ graphic file library on the web for
60+ categories, each category showing thumnails (preferably 
via a pull down list if possible), thumbnails clicked would bring
up dynamically called pages to include graphic name, IMG width
and height tags (viewable), author information including URL and/or
email address, files description,  a javascript background color
changer, and an included form which allows person to 
automatically update the author information, file description and 
email address/url of the author. 

I am NOT a programmer. Please do not email me snippets of 
code, they fall on cgi blind eyes. 

DO email me if you if you are capable of creating such a routine.
Please include your phone number so I can more easily discuss
the contract with you.  Once this is completed I will have additional
CGI routine requests to employ you for.

This is not a "job" position. I am not interested in hourly quotes. I
will pay for the CGI rotuine. You tell me how much money it will cost
me. 

Thanx!


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

Date: Mon, 15 Sep 1997 17:50:19 -0400
From: Raja Sambamurty <nysba@ny.ubs.com>
Subject: Re: local array in subroutine
Message-Id: <341DAD9B.375@ny.ubs.com>

Shawn M. Worsencroft wrote:
> 
> I am trying to make an array local to a subroutine, and return it to
> main.
> 
> The code works when the array is left as a global.
> It looks something like this.
> 
> sub read_configuration {
> 
> # code
> 
> return( @array )
> 
> } # end sub
> 
> This works fine, but if I try to make the declaration my @array at
> the beginning of the sub routine it does not.  My understanding is that
> arrays get returned as lists and I don't understand why there is a
> difference when a local array is implemented.  Please explain.
> 
> --
> ------------------------------------------------------------------------
>      _/_/_/  _/_/_/_/_/  _/_/_/  Shawn Worsencroft
>       _/        _/        _/     Electrical Engineer
>      _/        _/        _/      Intercept Technology Inc.
>     _/        _/        _/       shawn_worsencroft@intercept.com
>    _/        _/        _/        (404) 352-0111 ext. 20 (tel)
> _/_/_/      _/      _/_/_/       (404) 352-3744 (fax)  www.intercept.com
Try something like this, it works

sub read_configuration {
  my @larr
# code to populate your array like push @larr, 11
push @larr, 11;
push @larr, 29;
@array;     # the last expr evaluated will be returned
} # end sub

#main
@garr = &read_configuration;

foreach $i ( 0 ..$#garr ) {
   print "$garr[$i]\n";
}


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

Date: Mon, 15 Sep 1997 21:11:05 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Perl and WINNT4.0
Message-Id: <3421a3fb.378017390@igate.hst.moc.com>

[cc'd automagically to original author]

On Mon, 15 Sep 1997 21:24:40 +0200, Scott Balneaves
<chaos@futurenet.co.za> wrote:

>I have been told that Perl programming can cause problems on NT 4.0, any
>truth behind this and second of all where is the best place to start
>programming.

In general, poor programming in any language can cause problems on
almost any system.

Perl is no more or less prone to causing system problems than any
other well-established languages, IMHO.

>Basically I need to learn how to put a database online using a perl
>script to access it.

Many of us have done that.... :-)

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: 15 Sep 1997 20:26:01 GMT
From: alex@kawo2.rwth-aachen.de (Trudno zhit' v derevne bez nagana.)
Subject: Q: locking a dbm-file
Message-Id: <5vk5kp$3pm$1@news.rwth-aachen.de>

Hi,

can anyone advise me a nice way to lock a dbm-file.
I know, it is possible to open() that file and flock() it
and after that call dbmopen(), but maybe there's a
shorter way?

BTW i dont quite understand atomic operations in UNIX
(i am using Solaris on a Sparc). Maybe locking isnt
needed for dbm-file? Could it be that when 2 perl-scripts
are writing into the same dbm-file, UNIX cares about
one writing operation being complete before another?

Thanks and greetings
Alex

-- 
russkaya literatura v ------ http://www.simplex.ru/lit.html
internete http://www.friends-partners.org/~afarber/lit.html
java preferans ------------ http://www.simplex.ru/pref.html
besplatnye kommercheskie ob'yavleniya http://www.simplex.ru



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

Date: Mon, 15 Sep 1997 15:24:29 -0700
From: David Roberts <dtrobert@ladc.lockheed.com>
Subject: questions about 'zap'
Message-Id: <341DB59D.41C6@ladc.lockheed.com>

just tried to implement 'zap' from Oreilly's camel book.

he says that it should only require you to respond with a 'y' or other
character to decide whether to kill a process (i.e. no <RETURN>
required)

i'm running IRIX64 6.2 on an R10000. found that i do in fact need to hit
return to advance to the next process matching my pattern. when i get to
the second to the last, it skips over the last after hitting <RETURN>


any ideas what is wrong?

the part of the script that should be the cause is:
    read(TTYIN, $ans, 1);
    print TTYOUT "\n" if ($ans ne "\n");
    if ($ans =~ /^y/i) { kill $sig, $pid; }
    if ($ans =~ /^q/i) { last; }

thanks

-- 
| David Roberts (AKA "aeroman") || ...One tactical thermonuclear    |
| dtrobert@ladc.lockheed.com    || weapon can ruin your whole day:) |
| work  (805)572-5778           || (send complaints to "/dev/null") |
=====================================================================


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

Date: Mon, 15 Sep 1997 17:09:05 -0400
From: "Raymond K. Bush" <rbush@up.net>
To: Tony Curzon Price <j.curzon-price@ic.ac.uk>
Subject: Re: RegExp basics
Message-Id: <341DA3F1.7073@up.net>


Tony Curzon Price wrote:
> 
> Hello,
> 
> I think I'm missing something pretty basic about regexp's - can't really
> see how they're working (and I've trawled the faq's & manpages ...). Is
> there a kind soul out there who'll explain:
> 
> I have a great big file that looks like:
> 
> D,13-06-1997,HBD,YW02 PRICE3 ,-300,
> D,13-06-1997,HBD,YW02 PRICE5 ,770,
> 
> etc, repeated many times over
> I want to strip out just the number at the end, into 2 different files
> depending on hte name just before the "PRICEN" string.
> 
> Things I've tried:
> ($tt, $price) = split(/,\d+,/,$line);

ok, might something like this help point you in the right direction?

perl -e '
$line="D,13-06-1997,HBD,YW02 PRICE3 ,-300,";
($t, $price)=(split /,/,$line)[3,4];
($tt)=(split/ /,$t)[1];
print "$tt $price \n";'

PRICE3 -300 



--Ray
 .70~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~07.
      --- reply to rbush - at - up - dot - net ---
--- please include indication of past correspondence ---
      --- in order to receive a faster response ---


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

Date: Mon, 15 Sep 1997 18:18:53 -0400
From: "Marty" <Marty@capehatteras.net>
Subject: Re: Streaming chat mode with Perl running on Win32s. Any ideas?
Message-Id: <5vkc5h$1cg@redstone.interpath.net>

 What webserver, operating system, version of perl etc are you working
with??

have you considered fastCGI, or MODperl on apache, or if on NT ISAPI perl?

Icon Riabitsev wrote in article <874270545.20277@dejanews.com>...

>Hi!
>I have run into problems trying to figure out how to create a
>streaming
>chat mode with Perl (as on wbs chat). So far, the page won't show up
>until all code is compiled, and that's understandable. Is there any
>workaround to this problem? Or should I use something other than perl
>for
>that (sob-sob...)?
>
>A little explanation -- Streaming chat is the one where new posts are
>added to the page constantly, without reloading the page itself, as if
>that was just a slowly-downloading huge page (but it's not).
>
>If anybody has any ideas, please E-MAIL me (I'm not subscribed -- our
>school doesn't have a news server and I'm tired of switching from one
>open
>NNTP to another as they close on me).
>
>My e-mail is icon@lambuth.edu. Any input will be highly appreciated!
>
>Thanks a lot.
>
>Icon Riabitsev.
>
>-------------------==== Posted via Deja News ====-----------------------
>      http://www.dejanews.com/     Search, Read, Post to Usenet




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

Date: Mon, 15 Sep 1997 16:23:32 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: use LWP::Simple not found?
Message-Id: <comdog-ya02408000R1509971623320001@news.panix.com>

[redirected to comp.lang.perl.misc]

In article <341D8E08.FEE02C10@tou.com>, Joel Shellman <tou@tou.com> wrote:

>#!/usr/bin/perl
>print "Content-type: text/html\n\n";
>push( @INC, '/home/tou/perl/lib/perl5/site_perl' );

   what's all this then?  when does that `push` happen? (run time)

>use LWP::Simple;

   and when does this `use` happen? (compile time)

>It says that it can't find LWP::Simple.pm

   of course not!  it doesn't know where to look since the `use`
   happens before the `push`!

>The directory for the @INC is correct.  the LWP module is at
>.../site_perl/LWP/Simple.pm

try this:

   BEGIN { unshift @INC, '/home/tou/perl/lib/perl5/site_perl' }

which has the added bonus of putting your special path at the 
front of the @INC array :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Mon, 15 Sep 1997 23:39:24 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: use LWP::Simple not found?
Message-Id: <341dbad3.13912447@news.wwa.com>

In article <341D8E08.FEE02C10@tou.com>, Joel Shellman <tou@tou.com>
wrote and, in a later article, comdog@computerdog.com (brian d foy)
responded:

Joel>#!/usr/bin/perl
Joel>print "Content-type: text/html\n\n";
Joel>push( @INC, '/home/tou/perl/lib/perl5/site_perl' );

brian>what's all this then?  when does that `push` happen? (run time)

Joel>use LWP::Simple;

brian>and when does this `use` happen? (compile time)

Joel>It says that it can't find LWP::Simple.pm

brian>of course not!  it doesn't know where to look since the `use`
brian>happens before the `push`!

Joel>The directory for the @INC is correct.  the LWP module is at
Joel>.../site_perl/LWP/Simple.pm

brian>try this:
brian>
brian>BEGIN { unshift @INC, '/home/tou/perl/lib/perl5/site_perl' }
brian>
brian>which has the added bonus of putting your special path at the 
brian>front of the @INC array :)

I think it may be better to say

use lib LIST;
 
instead of 

BEGIN { unshift @INC, LIST }

Why?  I will give my reasons, starting with the weakest and working up
to the strongest.

1) The FAQ says to use 'use lib LIST;' and does not mention 'BEGIN {
unshift @INC, LIST }'.  The FAQ is rarely wrong.

2)  If there is a module for doing something, use it, especially if it
is part of the standard distribution.

3)  As I don't fully understand this reason,  I will read from the
book of the Camel (page 458).  "For each directory in LIST (called
$dir here), the lib module also checks to see whether a directory
called $dir/$archname/auto exists, where $archname is derived from
Perl's configuration information:

use Config;
$archname = $Config{'archname'};

If so, the $dir/$archname directory is assumed to be an
architecture-specific directory and is added to @INC in front of $dir.

If LIST includes both $dir and $dir/$archname, then $dir/$archname
will be added to @INC twice (assuming $dir/$archname/auto exists)."

In short, 'use lib LIST;' is not just another way to write 'BEGIN {
unshift @INC, LIST }'.  'BEGIN { unshift @INC, LIST }' doesn't work
for machine-dependent parts and 'use lib LIST;' does.  

4) I asked Tom Christiansen about a month ago and he told me about the
same thing as #3, but was much more to the point.  He also said to run
perl -V if I wanted to see for myself.  I decided just to trust him.
:-)

As a side note to Joel, he should really do all his program work first
and then begin printing out the web page or else the web client may
get tried of waiting for the rest of page while the script does
various and sundry thing that could have been done earlier and stop
receiving the data.

Joel wrote:

Joel>#!/usr/bin/perl
Joel>print "Content-type: text/html\n\n";
Joel>push( @INC, '/home/tou/perl/lib/perl5/site_perl' );
Joel>use LWP::Simple;


Streben nach Wahrheit

Faust Gertz
Philosopher at Large

36 inches = 1 yard
9 inches   = 1/4 yard
square root of 9 inches = square root of 1/4 yard
3 inches  = 1/2 yard



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

Date: Mon, 15 Sep 1997 21:08:47 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Username/Password script
Message-Id: <3420a392.377912589@igate.hst.moc.com>

[cc'd automagically to original author]

On 15 Sep 1997 19:21:37 GMT, churley@gte.net wrote:

>I am trying to create a Perl script, that used on with an HTML form,
>will allow users to enter a username and password to enter the site.
>This info will then be saved to a second file and the user will
>proceed to the entry page where this info can be entered so that entry
>to the site is allowed.  I want the user to create his own username
>and password and to be stored and security is not an issue as this is
>not a secure site and no credit card or personal info will be entered
>other than e-mail address.  Also, my server is an NT 4.0 server.  This
>is the first real script that I have tried to create and was curious
>as to where I should start.  I appreciate any help and please respond
>to me via e-mail at:

Starting points:

(1) Grab a copy of "Learning Perl on Win32 Systems" from O'Reilly &
Associates -- http://www.ora.com/

(2) The Perl FAQ and Docs on the Perl web site -- http://www.perl.com/

(3) This Group. :-)

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Mon, 15 Sep 1997 15:31:49 -0500
From: "D. Lamar Hawkins" <hawkinsd@email.uah.edu>
Subject: Why a three-digit exponential for double precision numbers?
Message-Id: <341D9B35.55C5@email.uah.edu>

I'm running an ActiveWare WIN32 port of perl based on perl 5.003_07
under Windows NT Workstation 4 on a PC. When I write out double-
precision numbers using printf "%e", the exponential has three digits.
If the same script is run under SGI IRIX, the exponential has only two
digits. What's going on? How can I get my script to output a two-digit
exponential while running on my PC? Thanks!

D. Lamar Hawkins
Center for Applied Optics/UAH


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

Date: Mon, 15 Sep 1997 15:21:15 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Why don't my <<HERE documents work?  Attempt #2!
Message-Id: <Pine.SGI.3.95.970915152015.18189A-100000@vangogh.bergen.org>


>> correct syntax i:
>> 
>> #!/user/local/bin/perl -w
>> use strict;   #   'cause it's in the FAQ :-)
>> print <<EOF
>> This is a test!
>> EOF
>> exit;
>> 
>> notice there is NO semicolon after the <<EOF
>
>Please stop giving out such bad advice. Thanks.

Geez... thanks for being so incredibly NOT harsh... if you're going to
point out a mistake, please correct me also...

----------------
| "You have the ability to annoy God!"
| 	- Joe Holbrook
----------------
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS
** I can be found on #perl on irc.ais.net as jpinyan **

- geek code -
GCS/IT d- s>+: a--- C+>++ UAIS+>$ P+++$>++++ L E--->---- W++$
N++ !o K--? w>+ !O M>- V-- PS PE+ !Y !PGP t+ !5 X+ R tv+ b>+
DI+++ D+>++ G>++ e- h- r y? 



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

Date: Mon, 15 Sep 1997 21:03:30 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Why don't my <<HERE documents work?  Attempt #2!
Message-Id: <341ea289.377647438@igate.hst.moc.com>

[cc'd automagically to original author]

On Mon, 15 Sep 1997 15:21:15 -0400, TechMaster Pinyan
<jefpin@bergen.org> wrote:

>>Please stop giving out such bad advice. Thanks.
>
>Geez... thanks for being so incredibly NOT harsh... if you're going to
>point out a mistake, please correct me also...

That would have been redundant, and Tom probably knew that. Several
others had already pointed out "better" ways.

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Tue, 16 Sep 1997 09:13:24 +1000
From: "MJ.VAN OOSTERHOUT" <v3100411@student.anu.edu.au>
Subject: Re: Why don't my <<HERE documents work?
Message-Id: <341DC114.4733@student.anu.edu.au>

Faust Gertz wrote:
> As there seems to be other oddities with my provider's installation of
> perl,
> 
> #!/user/local/bin/perl -w
> 
> and
> 
> #!/user/local/bin/perl -T
> 
> sometimes returns
> 
> >.nrecognized switch: -

That almost proves that there is a hidden \r at the end of the line
there. Are you sure your editor displays this kind of hidden character?
Maybe it hides it for your "benefit" and puts it back later.

Martijn
Australia


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

Date: Mon, 15 Sep 1997 12:49:02 -0700
From: Joel Shellman <tou@tou.com>
Subject: Re: WWW & Password Access
Message-Id: <341D912E.4A32C6AE@tou.com>

Tom Phoenix wrote:
> 
> On Fri, 12 Sep 1997, Toni Makela wrote:
> 
> > Is it possible to create system that ask validation for every one of my
> > HTML-pages when they are accessed!

This could be easily done if you had every one of your HTML documents
fed through a cgi script.  You could just require a password in the
query string and if it wasn't there you could put up a login page.  If
the password was there, then you could send the appropriate html doc.

Joel Shellman
-- 
TaoTree Research and Development
Web Development/Design, Virtual Servers, hosting, Perl/CGI programming
http://www.tou.com/rd/

Revolutionary new clicks-based Banner Exchange Guarantees you traffic
http://www.tou.com/ite/


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.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 1029
**************************************

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