[8850] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2467 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 30 17:19:25 1998

Date: Thu, 30 Apr 98 14:00:29 -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           Thu, 30 Apr 1998     Volume: 8 Number: 2467

Today's topics:
    Re: Bidirectional pipe filehandles? <lwp@flenser.ibm.net>
        Creating .exp and .lib files for a Perl Module <brhess@email.msn.com>
    Re: Easy Question?? Fixed <nic@mail.cyber-west.com>
        Easy Question?? <nic@mail.cyber-west.com>
        editor? <Philipp999@gmx.net>
    Re: editor? <brianm@kodak.com>
        Env package Q johnnie@NOPERSONALMAIL.edu
    Re: file comparison <aqumsieh@matrox.com>
    Re: Help Beginner Modify A Little Code (Jonathan Stowe)
    Re: Help-Perl misread Env variable 100042.2616@compuserve.com
    Re: Help-Perl misread Env variable 100042.2616@compuserve.com
    Re: Help-Perl misread Env variable <rootbeer@teleport.com>
        Home Rolled Telnet: Help! johnvv@earthling.net
        How do I format the space in a print statement? <bth@acsu.buffalo.edu>
    Re: How to find the number of matches in a string <grinch@whoville.com>
    Re: How to stuff control character into a variable <rootbeer@teleport.com>
    Re: inserting characters (Jonathan Stowe)
        IO Timeout erro jeff_mccreary@yahoo.com
    Re: IO Timeout erro <rootbeer@teleport.com>
        Looking for an idiom (cf. Schwartzian Transform) (Mitchell Morris)
    Re: Looking for an idiom (cf. Schwartzian Transform) <rootbeer@teleport.com>
        multiple commands at a time? <Philipp999@gmx.net>
        multiple commands at the same time? <Philipp999@gmx.net>
        multiple commands at the same time? <Philipp999@gmx.net>
    Re: multiple commands at the same time? <brianm@kodak.com>
    Re: Newbie: How do you compile a script in Perl for Win <barnett@houston.Geco-Prakla.slb.com>
    Re: Ongoing E-Mail flood by mikes@activestate.com (Jonathan Stowe)
    Re: Pattern Matching <alpaca@iname.com>
    Re: perl  -e filenamewith_regex datafiles question <rootbeer@teleport.com>
    Re: Perl for Win32 not writing to file (Jonathan Stowe)
    Re: Perl web server.... (John Porter)
        Use once? johnnie@NOPERSONALMAIL.edu
    Re: Use once? <rootbeer@teleport.com>
    Re: Way of getting a list of installed modules? (Nathan V. Patwardhan)
    Re: You people want Perl to be popular? (Jonathan Stowe)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 30 Apr 1998 19:14:03 GMT
From: Lou Poppler <lwp@flenser.ibm.net>
Subject: Re: Bidirectional pipe filehandles?
Message-Id: <3548cd7b.0@news1.ibm.net>

Sounds to me like a C problem.  The stdout of each child should go to
the same place as the parent's.  Perhaps you could include some
fflush( stdout );
at strategic points in the C program ?

On Mon, 20 Apr 1998 00:34:20 -0500, 
Alik Widge <alik.widge@dartmouth.edu> wrote:
: What I've got is a C executable of which I need to run 11 copies at once,
: being able to switch which copy I'm communicating with at will. Commands
: from stdin (unless preceded by a metacharacter) go to the currently-active
: copy, and anything it puts on its stdout should go to the stdout of the
: wrapping script.

: Doing the switching between copies and executing the 11 copies was easy
: enough; doing an (open "FILE$i", "| <executable-name>) 11 times was
: basically all I needed.

: This gives me the ability to send them commands, but I can't read back
: what they write. I tried redirecting their stdouts to a file, but they
: don't actually write data to the file until they quit, and that's not much
: use. I tried a very ugly hack where their output was piped to another
: script which then opened a socket connection back to the originating
: script, but the data *still* doesn't show up until the programs of
: interest have quit.

: Now, on page 163 of the 1st Edition camel book (the "open" reference),
: Larry and Randal tell me that an open command which pipes both in and out
: should be easy to build. How, though? I've been poring over the pipe() and
: fork() man pages and function references for a couple hours now, and I'm
: not seeing it.

: Alik


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

Date: Thu, 30 Apr 1998 15:38:44 -0400
From: "Bill Hess" <brhess@email.msn.com>
Subject: Creating .exp and .lib files for a Perl Module
Message-Id: <#ijLGCHd9GA.302@upnetnews03>

I have a .dll file and want to create a Perl Module - How can I create a
 .exp and .lib file to go with it???

Bill Hess
brhess@msn.com





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

Date: Thu, 30 Apr 1998 12:16:41 -0600
From: Madness <nic@mail.cyber-west.com>
Subject: Re: Easy Question?? Fixed
Message-Id: <3548C009.C712D2CC@mail.cyber-west.com>

Just had to play a bit more.  :-)

If you are interested, I read(wow) and decided to try ${$value_race}, and
it works. (Imagine that!)

Later

Madness wrote:

> I am writing a flatfile database program to let users find results to
> motocross races based on class and race.  I
> don't want to make more work than I need to, so I'm trying something
> that I think I should be able to do.  The
> line that reads in the data looks like this:
> ($clsid, $class, $name, $number, $ww1, $ww2, .....$ww16) = split
> (/,/,$_,20);
> $ww1 is (Wild West Race #1, etc.)
> The variable I read in from the form for race is ww1 - ww16.  Is there a
> way I can use this to print the
> appropriate variable from my database using the contents of the race
> variable?
> ex:
> race = ww2;
> I store the value of race in a variable called $value_race using CGI.pm
> parameter function.
>
> I am now going to print $ww2.
>
> It seems that cgi-lib.pl would do this using the $in{'race'}, but I
> haven't had any luck with CGI.pm yet.
>
> Thanks
>
> Nic





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

Date: Thu, 30 Apr 1998 10:59:24 -0600
From: Madness <nic@mail.cyber-west.com>
Subject: Easy Question??
Message-Id: <3548ADEC.2020B0C6@mail.cyber-west.com>

I am writing a flatfile database program to let users find results to
motocross races based on class and race.  I
don't want to make more work than I need to, so I'm trying something
that I think I should be able to do.  The
line that reads in the data looks like this:
($clsid, $class, $name, $number, $ww1, $ww2, .....$ww16) = split
(/,/,$_,20);
$ww1 is (Wild West Race #1, etc.)
The variable I read in from the form for race is ww1 - ww16.  Is there a
way I can use this to print the
appropriate variable from my database using the contents of the race
variable?
ex:
race = ww2;
I store the value of race in a variable called $value_race using CGI.pm
parameter function.

I am now going to print $ww2.

It seems that cgi-lib.pl would do this using the $in{'race'}, but I
haven't had any luck with CGI.pm yet.

Thanks

Nic



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

Date: Thu, 30 Apr 1998 17:22:47 +0100
From: Philipp <Philipp999@gmx.net>
Subject: editor?
Message-Id: <3548A557.372E1F20@gmx.net>

Hi there!

Does anybody know of a nice perl editor fin win95?

thx
Phil



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

Date: Thu, 30 Apr 1998 16:57:20 -0400
From: Brian Mathis <brianm@kodak.com>
To: Philipp <Philipp999@gmx.net>
Subject: Re: editor?
Message-Id: <3548E5B0.E282E992@kodak.com>

Philipp wrote:
> 
> Hi there!
> 
> Does anybody know of a nice perl editor fin win95?
> 
> thx
> Phil

Lemmy is very good.  There is also a version of emacs for windows.

Brian Mathis


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

Date: 30 Apr 1998 13:35:01 -0600
From: johnnie@NOPERSONALMAIL.edu
Subject: Env package Q
Message-Id: <6iajp5$g014@holly.ColoState.EDU>

   I'm kinda analyzing Perl packages and I was wondering if anyone could
help me to understand this portion of the Env module:

   sub TIESCALAR {
	bless \($_[1]);
   }

   The \() syntax makes this statement:

        bless (\$_[1]);

   But that's an array of references and not a reference itself, and
bless needs a reference as it's argument!  I successfully replicated
(I think) the Env module using the following code:

sub TIESCALAR {
        my($pkg, $key) = @_;
        return bless \$ENV{$key};
}
 
sub FETCH {
        my($pkg) = @_;
        return $$pkg;
}

   [STORE omitted because it's the tie I care about]

   And this also worked. I would think this is the straightforward way!
Could someone explain what the Env way is doing?  Thanks!

   - Johnnie B
   
-- 
   - Johnnie Blanco Jr.
   - "Just can't sit.  Gotta get jiggy wit it, mmm, that's it!"
   -    Will Smith [Gettin Jiggy Wit It]


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

Date: Thu, 30 Apr 1998 14:12:05 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: file comparison
Message-Id: <3548BEF5.6636849@matrox.com>

Read both files ... split the lines to find the required data .. store the data in
two
hash arrays with the TABLESPACE_N(AME) as the keys ...
Then compare the keys of both tables!

If that was ambiguous ... you'd better refer to the Llama book!

Greg Land wrote:

> Since I know that there are ppl here that really *KNOW* perl, here goes:
>
> I have one file looking like this:
>
> MOVE_IXLEFT  GRP_PK                       102400       20480
> MOVE_IXLEFT  ER_MESS_TEMP_IDX              20480       20480
>
> TABLESPACE_N SEGMENT_NAME         INITIAL_EXTENT NEXT_EXTENT
> ------------ -------------------- -------------- -----------
> MOVE_IXLEFT  ER_MESS_IDX                   20480       20480
> MOVE_IXLEFT  DOWNLD_ERR_LOG_PK           5120000     5120000
>
> And another file that looks like this:
>
> TABLESPACE_NAME                TOTAL******BYTES
> ------------------------------ ----------------
> "MOVE_IXLEFT                         152,203,264                                 "
> "MOVE_IXMIX1                           5,525,504                                 "
> "MOVE_IXMIX1                         298,881,024                                 "
>
> now for the question: I need to compare the number values between the
> "NEXT_EXTENT" and the "TOTAL BYTES" and see which is larger, but only
> when the "TABLESPACE_N" is the same as "TABLESPACE_NAME".
>
>                                                 Thanx in advance
>                                                    Question
>
> PS. Any help would be greatly appreciated :)



--
Ala Qumsieh             | "How much wood would a woodchuck
ASIC Design Engineer    |  chuck if a woodchuck could
Matrox Graphics Inc.    |  chuck wood?"
Montreal, Quebec        |             - Trivial ... 5!





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

Date: Wed, 29 Apr 1998 17:32:17 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Help Beginner Modify A Little Code
Message-Id: <35475242.7600851@news.btinternet.com>

On Thu, 30 Apr 1998 12:30:44 -0400, Frank Blanchard wrote :


>====================================================
> $search_results .= "<TR>";
>            $hit_counter = "1";
>            foreach $field (@row)
>              {
>              $search_results .= "<TD>$field</TD>";               
>              }
>            $search_results .= "</TR>";
>            }
>====================================================

e.g.

s/TR/UL/g;
s/TD/LI/g;

/J\
Jonathan Stowe
Some of your questions answered http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm


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

Date: Thu, 30 Apr 1998 13:01:42 -0600
From: 100042.2616@compuserve.com
Subject: Re: Help-Perl misread Env variable
Message-Id: <6iaea5$4ga$1@nnrp1.dejanews.com>

In article <Pine.GSO.3.96.980429153354.2153B-100000@user2.teleport.com>,
  Tom Phoenix <rootbeer@teleport.com> wrote:
>
> On Wed, 29 Apr 1998 100042.2616@compuserve.com wrote:
>
> > When I used $ENV
>
> You mean %ENV, of course.
>
> > to obtain the value of an environment variable, the value came back
> > corrupted.
>
> Are you sure? You could be right, but that doesn't seem likely. How can
> you be sure that it was set to the right value in the first place?
>
> > Well, the English text came back fine. But I have a few
> > bytes non alphabetic text and they came back wrong. Any idea why?
>
> Maybe the variable was mis-set or encoded in some way by the calling
> program.

I checked if the variable was set correctly. It was correct.
I used the command  SET QUERY_STRING=ABCDEF
to set the env. variable. This command was put inside a batch file. Running
the batch file set the variable. To check what was set, I used the command
SET without any argument. The operating system then lists the variables and I
could see they were set correctly.


> > Seems Perl used some kind of translation. How can I disable the
> > translation?
>
> Perl doesn't secretly tamper with the environment variables! :-) If it
> says that the variable contains a certain string, then that's what it
> contains.

One documentation that came along with my perl package mentioned
something like setup for language. Seems perl could be adjusted to a specific
country or language. Following is a quote from the document:

"perl18n - Perl i18n (internalization)

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

DESCRIPTION

Perl supports the language-specific notions of data like ``is this a letter''
and ``which letter comes first''. These are very important issues especially
for languages other than English -- but also for English: it would be very
na&239ve indeed to think that A-Za-z defines all the letters.


Perl understands the language-specific data via the standardized (ISO C,
XPG4, POSIX 1.c) method called ``the locale system''. The locale system is
controlled per application using one function call and several environment
variables. "

I have read the document three times but still couldn't figure out how to tell
perl to read the raw data of the environmental variable.

Wayne

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 30 Apr 1998 13:10:17 -0600
From: 100042.2616@compuserve.com
Subject: Re: Help-Perl misread Env variable
Message-Id: <6iaeqo$5ee$1@nnrp1.dejanews.com>

In article <lWU11.488$j41.316253@news.tpnet.pl>,  "Zbigniew Malinowski"
<zmalino@rocketmail.com> wrote:> So I think its rather a problem of Windows
and not of PERL. And you didn't> mention
> how did you set the environmental
variable.
I used the command  SET QUERY_STRING=ABCDEF
to set the env.
variable. This command was put inside a batch file. Runningthe batch file
set the variable. To check what was set, I used the command SET without any
argument. The operating system then lists the variables and I could see they
were set correctly.
I am not sure that the problem is not coming from perl.
One documentationthat came along with my perl package mentioned 
something
like setup for language. Seems perl could be adjusted to a specific country
or language. Following is a quote from the document:
"perl18n - Perl i18n
(internalization) 
------------------------------------------------------------------------
DESCRIPTION 
Perl supports the language-specific notions of data like ``is
this a letter'' and ``which letter comes first''. These are very important
issues especially for languages other than English -- but also for English:
it would be very na&239ve indeed to think that A-Za-z defines all the
letters. 

Perl understands the language-specific data via the standardized
(ISO C, XPG4, POSIX 1.c) method called ``the locale system''. The locale
system is controlled per application using one function call and several
environment variables. "

I have read the document three times but still
couldn't figure out how to tell perl to read the raw data of the
environmental variable.

Wayne

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 30 Apr 1998 19:14:06 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: 100042.2616@compuserve.com
Subject: Re: Help-Perl misread Env variable
Message-Id: <Pine.GSO.3.96.980430115831.8307U-100000@user2.teleport.com>

On Thu, 30 Apr 1998 100042.2616@compuserve.com wrote:

> I checked if the variable was set correctly. It was correct.  I used the
> command SET QUERY_STRING=ABCDEF to set the env. variable. This command
> was put inside a batch file. Running the batch file set the variable. To
> check what was set, I used the command SET without any argument. The
> operating system then lists the variables and I could see they were set
> correctly. 

So, are you saying that your program didn't see ABCDEF in this case?

> One documentation that came along with my perl package mentioned
> something like setup for language. Seems perl could be adjusted to a
> specific country or language. Following is a quote from the document: 
> 
> "perl18n - Perl i18n (internalization)

Perl does have support for i18n, but it's _still_ not going to tamper with
environment variables all by itself! Perl is subtle, but not malicious.

Here's a simple script to report the exact (hex) value of your environment
variable; you may run it from the shell or as a web-based script. 

    #!/usr/bin/perl
    print "Content-type: text/plain\n\n";
    print "QUERY_STRING is ";
    if (exists $ENV{QUERY_STRING}) {
	print unpack("H*",$ENV{QUERY_STRING}), " in hex.\n";
    } else {
	print "undefined.\n";
    }

Try this: Set an environment variable from the shell, then run this
script in that environment. Do you get a value which differs from the
proper one? If not, you've found a bug in Perl.

If Perl always gives you the right value when called from the shell, then
you should be able to trust that script when you run it over the web. If
it says that's what's in the environment, then that's what's in the
environment!

Just to double-check: You do know that it's normal for the value of
QUERY_STRING to be encoded before your program sees it, right? If a
browser or server has encoded that string in a way you don't like, that's
not Perl's fault! :-) 

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 30 Apr 1998 13:36:13 -0600
From: johnvv@earthling.net
Subject: Home Rolled Telnet: Help!
Message-Id: <6iagat$8tg$1@nnrp1.dejanews.com>

Hello all,

I have a pretty simple server set up to wrap my MLDBM db, and it works w/
regular telnet but my client has a problem while using the diamond operator
with both STDIN and the server's file descriptor at the same time.

Here is what I have so far, I tried to get "read" to work but no luck.

Thanks in advance, John van V.
___________________________________________________________



use strict ;
use Socket ;

$remote_host =  shift or die "$0: no hostname\n" ;
my $port = 6666 ;
my $ip = inet_aton $remote_host
  or die "unknown host: $remote_host";
my $proto = getprotobyname 'tcp' ;
socket ADMIND, PF_INET, SOCK_STREAM, $proto or die "socket: $!" ;
connect ADMIND, sockaddr_in($port, $ip) or die "connect: $!";
select ADMIND ; $| = 1 ;

while (<STDIN>) {
select ADMIND ; $| = 1                    ;
print ADMIND $_                           ;
#while (<ADMIND>) { print STDOUT $_ }
print STDERR "now what ??\n"              ;
}

close ADMIND or die "close: $!" ;






-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 30 Apr 1998 16:33:11 -0400
From: Bryan T Hoch <bth@acsu.buffalo.edu>
Subject: How do I format the space in a print statement?
Message-Id: <Pine.GSO.3.96.980430162859.13850B-100000@xena.acsu.buffalo.edu>

Hi.
I'm trying to specificy the length a print out that I'm working on. I want
to specify how long I want the printed statements should be, but am
unsure how.
An example migh clear up what I am talking about.

Ex.
I want to print 12 characters (white space or other), so if I only had 6
characters I would need 6 more of white space to be used as filler...

print "hello.";
print "<----";

would be 

hello.     <----

Anyone know how to do this?
Anyone even know what I'm talking about?
Thanks in advance.
						Bryan H



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

Date: Thu, 30 Apr 1998 14:27:06 -0400
From: "Grinch" <grinch@whoville.com>
Subject: Re: How to find the number of matches in a string
Message-Id: <6iaeqd$jnm@fridge.shore.net>

Mark-Jason Dominus wrote in message <6i7c1g$5fv$1@monet.op.net>...

>Brian Mathis  <brianm@kodak.com> wrote:
>>    grep EXPR,LIST
>
>And this is relevant how?  A list is not a string.


Actually, it's not a letter-for-letter example, but it brought to mind a
potential (although probably not ideal) solution. It made me think about the
problem, and in that sense, it's probably a more helpful answer than most.

$count = grep /findme/, ( split /\s/, $inhere);

-grinch

--
-----
"It's not real coffee unless the sugar cubes float." - me

Sherm Pendley
grinch@whoville.com
http://www.whoville.com





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

Date: Thu, 30 Apr 1998 19:23:34 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Yuri Shtil <shtil@netcom.com>
Subject: Re: How to stuff control character into a variable
Message-Id: <Pine.GSO.3.96.980430122026.8307W-100000@user2.teleport.com>

[ I think I misunderstood this the first time I tried answering, so let's
try again... ]

On Thu, 30 Apr 1998, Yuri Shtil wrote:

> $a = 'F';
> 
> I want $b assigned to the equivalent of
> 
> $b = "\xF", not directly but through $a

You want $b to be the character whose hex representation is in $a, right?
So, if $a is '4A', $b should get 'J'. 

   $b = pack "H2", $a;

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/




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

Date: Wed, 29 Apr 1998 17:32:19 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: inserting characters
Message-Id: <35476254.8392155@news.btinternet.com>

On Thu, 30 Apr 1998 16:09:54 GMT, Jeff McCreary wrote :

>Is there a way to insert a "/" into the middle of a string without
>trying to concantenate substrings?

TIMTOWTDI

(Some ways being more sensible than others of course).

#!/develop/bin/perl

# 1.

$string = "astringtoinsertslashin";
@x = split('',$string);
splice(@x,8,0,'/');
$string = join("",@x);
print $string,"\n";

# 2.

$string = "astringtoinsertslashin";
$string =~ s|(.{8})(.*)|$1/$2|g;
print $string,"\n";

# 3.

$string = "astringtoinsertslashin";
$string = sprintf("%s/%s",unpack("a8a*",$string));
print $string,"\n";

# 4.

$string = "astringtoinsertslashin";
$count = 1;
for ( split('',$string))
{
   $temp .= $_;
   $temp .= "/" if ($count++ == 8 );  
}
$string = $temp;
print $string,"\n";

__END__

But Hey, lets *not* benchmark.
(Sorry Jonathan)

/J\
Jonathan Stowe
Some of your questions answered http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm


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

Date: Thu, 30 Apr 1998 13:22:22 -0600
From: jeff_mccreary@yahoo.com
Subject: IO Timeout erro
Message-Id: <6iafgs$6vt$1@nnrp1.dejanews.com>

I have a fixed length text file that's being read into an array.  Each element
of the array is based on the length of each column.  I have this file being
read into the array in a while construct that creates a html table based on
certain column meeting search requirements.

open(F, $Filename) || die "File can not be opened";
while (defined ($line = <F>)){
    @data = $line =~ /all of the column lengths/;
    #prints the table
}
close(F) || "File did not close";

When the loop is completed the file is closed, supposedly.  To make a long
story short, the script worked just fine yesterday but it doesn't today.  I
had the system admin take a look at the error log and it's recorded "IO
timeout error".  I've looked through every bit of documentation and searched
this newsgroup.  Can anyone help?

TIA,
Jeff

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 30 Apr 1998 19:18:58 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: jeff_mccreary@yahoo.com
Subject: Re: IO Timeout erro
Message-Id: <Pine.GSO.3.96.980430121526.8307V-100000@user2.teleport.com>

On Thu, 30 Apr 1998 jeff_mccreary@yahoo.com wrote:

> I had the system admin take a look at the error log and it's recorded
> "IO timeout error".  

That doesn't sound like a Perl error message. Did you find the message in
perldiag? If the diagnostic message you're getting isn't listed in
perldiag, it probably didn't come from Perl, and you should check to see
what other program may have issued it. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 30 Apr 1998 19:32:38 GMT
From: mgm@unpkhswm04.bscc.bls.com (Mitchell Morris)
Subject: Looking for an idiom (cf. Schwartzian Transform)
Message-Id: <slrn6khkem.iui.mgm@unpkhswm04.bscc.bls.com>

I recently finished reading "Far More Than Everything You've Ever Wanted to
Know About Sorting" and immediately ran out to find a reason to apply my
new knowledge of the Schwartzian Transform. Of course, I had problems almost
from the outset.

In short, I wanted to sort a list where the key words were an optional
number followed by an alpha word, e.g. Foo, 0Foo, 1Foo, Bar, 0Bar, 1Bar, etc.
I of course wanted all the "Foo" words to sort together, and all in numeric
sequence amongst themselves. My first try, which doesn't work, was:

map { $_->[0] } sort { $a->[1] cmp $b->[1] }
	map { [ $_, s/(\d+)(\D+)/$2$1/ ] } @lines;

The difficulty is that s/// returns the number of substitutions performed,
and what I want is the resulting string. Is there a perl idiom that I
could substitute here so the map will work the way I want it to?

-- 
Mitchell Morris
mmorris@mindspring.com

When all other means of communication fail, try words.


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

Date: Thu, 30 Apr 1998 20:45:30 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: mmorris@mindspring.com
Subject: Re: Looking for an idiom (cf. Schwartzian Transform)
Message-Id: <Pine.GSO.3.96.980430133039.8307X-100000@user2.teleport.com>

On 30 Apr 1998, Mitchell Morris wrote:

> The difficulty is that s/// returns the number of substitutions performed,
> and what I want is the resulting string. Is there a perl idiom that I
> could substitute here so the map will work the way I want it to?

Yes; you want a lexical copy of the data within the (last) map, perhaps
something like this.

	map {
	    my $copy = $_;
	    $copy =~ s/(\d+)(\D+)/$2$1/;
	    [ $_, $copy ];			# Return from map
	} @items;

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 30 Apr 1998 16:54:23 +0100
From: Philipp <Philipp999@gmx.net>
Subject: multiple commands at a time?
Message-Id: <35489EAF.1185F616@gmx.net>

Hi all!

I am trying to run multiple 'whois' commands at a time.

Does anybody know how to do that?

Thanks in advice

Philipp



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

Date: Thu, 30 Apr 1998 20:00:45 +0100
From: Philipp <Philipp999@gmx.net>
Subject: multiple commands at the same time?
Message-Id: <3548CA5D.F60FBFC@gmx.net>

Hi all!

Does anybody know how to run multiple commands at the same time (...or
nearly at the same time)?

The problem is: I want to write a script that runs multiple 'whois'
commands, but I don't
want to wait for the completion of the first 'whois' to run the next
one.
 ....takes a bit too long if I want to check 20 whois servers ;)

Thanx

Philipp





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

Date: Thu, 30 Apr 1998 19:41:41 +0100
From: Philipp <Philipp999@gmx.net>
Subject: multiple commands at the same time?
Message-Id: <3548C5E5.E030EADE@gmx.net>

Hi all!

Does anybody know how to run multiple commands at the same time (...or
nearly at the same time)?

The problem is: I want to write a script that runs multiple 'whois'
commands, but I don't
want to wait for the completion of the first 'whois' to run the next
one.
 ....takes a bit too long if I want to check 20 whois servers ;)

Thanx

Philipp



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

Date: Thu, 30 Apr 1998 16:56:33 -0400
From: Brian Mathis <brianm@kodak.com>
To: Philipp <Philipp999@gmx.net>
Subject: Re: multiple commands at the same time?
Message-Id: <3548E581.19F4D649@kodak.com>

Philipp wrote:
> 
> Hi all!
> 
> Does anybody know how to run multiple commands at the same time (...or
> nearly at the same time)?
> 
> Thanx
> 
> Philipp

You only had to ask once..

take a look at the documentation for 'fork()'.  That should do what you
want. 

Brian Mathis


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

Date: Thu, 30 Apr 1998 14:08:30 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: Jonathan Burns <JonathanBurns@onlineinfoservices.com>
Subject: Re: Newbie: How do you compile a script in Perl for Win32?????
Message-Id: <3548CC2E.7B73E8D5@houston.Geco-Prakla.slb.com>

[courtesy cc to cited author]

Jonathan Burns wrote:
> 
> I have a .pl file, but when I access it from the web, it displays the script
> as if it were a text file. 
First majorly important question:  Is your web server running on the
machine from which you are trying to pull up the file?  If you do not
have a web server running, or enter file:/path/to/file/myscript.perl,
the browser will pull it up as plain text, because a browser knows
nothing of cgi.

You need to get a web server running.  Once you do, make sure your web
server understands that this is a cgi script that should be executed. 
See the documentation for the web server on how to set this up.

You will probably also want to assosciate pl extensions with the perl
executable.  See assistance in a windows newsgroup on how to do that.

> Does it need to be compiled? 
Perl scripts are compiled every time they run, since perl is an
interpreted language.

> How do you compile
> it with Perl for Win32?
perl myscript.pl

causes the script to be compiled and run in one fell swoop.

> 
> Thanks,
> 
> Jon Burns
> JBurns@onlineinfoservices.com

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

----------------------------------------------------------------------
Dave Barnett                 U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng    U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------


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

Date: Wed, 29 Apr 1998 17:32:15 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Ongoing E-Mail flood by mikes@activestate.com
Message-Id: <3547478b.6449568@news.btinternet.com>

On Thu, 30 Apr 1998 10:10:37 GMT, Marc Haber wrote :

<snip>
>
>I have received this notice _five_ times, the flood is still ongoing.
>Can anyone confirm this?
>
Six or seven.  However a quick peek at the headers is quite
illuminating.

/J\
Jonathan Stowe
Some of your questions answered http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm


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

Date: 30 Apr 1998 20:34:44 GMT
From: "AmD" <alpaca@iname.com>
Subject: Re: Pattern Matching
Message-Id: <6ian94$2a4$0@206.165.146.137>

    Ok, since this post seems to be languishing I will come out of lurking
mode and try to answer.  Still very new to perl, all corrections
appreciated.

    First, and as usual, this is covered in the FAQ.  Surprised Tom didn't
mention it already <grin>.


>$NewHRef = '<!--#include file="clindisc.mdssi"-->';

I am not sure what you are doing above, but it kind of scares me.  So I will
leave it for a braver soul.

>
>The code I am trying to find and parse out:
><TABLE CELLPADDING="3" WIDTH="100%" cellspacing=0>
><TR><TD BGCOLOR="#AA0000"><FONT COLOR="#FFFFFF"><strong>Clinical
>Discussion</strong></FONT></TD></TR>
><TR><TD BGCOLOR="#EEEEEE">
>Read Forum Comments<p>
><A HREF="form-ClinDiscussion.html">Submit Your Comment</A>
></td></tr></table>
>
>$LookFor1 = "<TABLE(.*?)Clinical Discussion(.*?)Submit Your
Comment(.*?)/TABLE>";
>$buffer =~ s/$LookFor1/$NewHRef/ig;
>

    The problem is that you need to get past the line returns.  If you want
to just find the lines with the data you want you could use the range
operator (..) see perlop.  Which will give you the lines that contain the
match.

    If you want to match just the specific text then you need to read in
longer strings.  Assuming blank lines between sections, and that the text
you are searching for will have not blank lines within, you could use
something like:

$filename = "file.htm"
$/ = '';    #read all information between line breaks into one big string
(that is two ' )
              # undef $/; would just read the whole file into one long
string!
open (IN, $filename);
while (<IN>){
    chomp;
    if (/($lookfor1)/is) {print $1;} #You need the /s to cross line
boundries.
}

or use s/// or whatever.

HTH

AmD

Back to lurking

Allan M. Due
Due@discovernet.net
Admin@WhiteCrow.net

"There are two major products that come out of Berkeley: LSD and UNIX. We
don't believe this to be a coincidence."
-Jeremy S. Anderson






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

Date: Thu, 30 Apr 1998 18:41:39 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Miten S Mehta <mehta@mama.indstate.edu>
Subject: Re: perl  -e filenamewith_regex datafiles question
Message-Id: <Pine.GSO.3.96.980430114100.8307P-100000@user2.teleport.com>

On Thu, 30 Apr 1998, Miten S Mehta wrote:

> I have put a bunch of regex in a file to operate on input file and this
> does not work.
> 
> perl -pi.bak -e regex_file.pl datafile

You seem to be mistaken about what those command line options do. See
perlrun. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 29 Apr 1998 17:32:13 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Perl for Win32 not writing to file
Message-Id: <354739f0.2966718@news.btinternet.com>

On Thu, 30 Apr 1998 14:35:21 +1000, Jaime Metcher wrote :

>Jonathan Stowe wrote:
>> 
>> On Wed, 29 Apr 1998 10:52:13 -0300, Gilberto Mautner wrote :
>> 
>> <snip>
>> 
>> >use CGI;
>> >$query = new CGI;
>> >$SAIDA = ">>OUTPUT2.TXT";
>> >open(SAIDA);
>> 
>> Aieee.  I think you might want:
>> open(SAIDA,$SAIDA) || die "Cant open the file - $!";
>> 
>snip
>
>The "|| die..." is right and good as all can see, but in changing "open
>(SAIDA)" to "open (SAIDA,$SAIDA)", are you deprecating the open(SAIDA)
>shorthand?
>
Not at all.  It just makes what is happening more apparent as an
example.  The usage is well and good however.

/J\
Jonathan Stowe
Some of your questions answered http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm


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

Date: Thu, 30 Apr 1998 18:08:49 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Perl web server....
Message-Id: <MPG.fb289905c89c3e4989684@news.min.net>

On Thu, 30 Apr 1998 13:35:15 -0400,
in article <3548B653.755C6DB8@webchamps.com>,
chrisw@webchamps.com (Chris Wertman) wrote:
> Some time ago I saw a webserver written in perl.. I have searched .
> engines.DejaNews etc and stilll cannot find it ,... any pointers as to
> where on the web it may live are appreciated...

Check out the MacPerl WebServer, at http://www.reed.edu/~ckasow/
Don't be misled by the name: it's not MacPerl-specific.

John Porter



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

Date: 30 Apr 1998 13:56:14 -0600
From: johnnie@NOPERSONALMAIL.edu
Subject: Use once?
Message-Id: <6ial0u$2ggg@holly.ColoState.EDU>

   Another inquisitional question! I thought REQUIRE was only supposed to
REQUIRE once?  As in, if a module has already been REQUIREd once, don't do
it again.  But this code:

use MyMod;
use MyMod;
use MyMod;
use MyMod;

   And this package:

package MyMod;
 
$num = 0;
 
sub import {
        $num++; print "Used me $num times!\n";
}
 
1;

   Produce this output:

Used me 1 times!
Used me 2 times!
Used me 3 times!
Used me 4 times!

  So what's up?

   - Johnnie B
-- 
   - Johnnie Blanco Jr.
   - "Just can't sit.  Gotta get jiggy wit it, mmm, that's it!"
   -    Will Smith [Gettin Jiggy Wit It]


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

Date: Thu, 30 Apr 1998 20:50:34 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: johnnie@NOPERSONALMAIL.edu
Subject: Re: Use once?
Message-Id: <Pine.GSO.3.96.980430134717.8307Y-100000@user2.teleport.com>

On 30 Apr 1998 johnnie@NOPERSONALMAIL.edu wrote:

>    I thought REQUIRE was only supposed to REQUIRE once?  As in, if a
> module has already been REQUIREd once, don't do it again. 

You must mean 'require'. Yes, Perl keeps track of require'd libraries and
won't re-load them.

> But this code:
> 
> use MyMod;
> use MyMod;
> use MyMod;
> use MyMod;
> 
>    And this package:
> 
> package MyMod;
>  
> $num = 0;
>  
> sub import {
>         $num++; print "Used me $num times!\n";
> }
>  
> 1;
> 
>    Produce this output:
> 
> Used me 1 times!
> Used me 2 times!
> Used me 3 times!
> Used me 4 times!

As you'd expect, the module was loaded once, then import was called four
times. That's what you asked for, so it's a good thing that Perl did it! 
:-)  Don't confuse loading a module with calling import, they're very
different. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 30 Apr 1998 18:40:05 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Way of getting a list of installed modules?
Message-Id: <6iagi5$lv8@fridge.shore.net>

Joel Horowitz (horowitz@ulb.ac.be) wrote:

: I'd like to know if there's a clever and universal way to get a list of
: all the installed modules... I know I could do a loop on @INC and do a
: system call using the unix 'find ' utility, but I don't want to do that,
: because on every system the command line arguments are different.

I think that you can use the CPAN module for this.  Read the doc for
the section about Autobundle.  That should tell you about the modules
you have installed.

--
Nathan V. Patwardhan
please don't send spam to president@whitehouse.gov


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

Date: Wed, 29 Apr 1998 17:32:11 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: You people want Perl to be popular?
Message-Id: <3547369b.2113788@news.btinternet.com>

On Thu, 30 Apr 1998 17:56:35 +0200, N i c l a s O l o f s s o n wrote
:

>
>Sounds like you should start writing some Cobol then :)
>
Possibly typical Local Government IT Department:

Total Number of Programmers: 8

COBOL Programmers:   6
VB Programmers:          3
C Programmers:            3
Perl Programmers:         1

Mainframe systems       0
Unix Systems                3
NT Systems                  2
PCs                               450

/J\
Jonathan Stowe
Some of your questions answered http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm


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

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 2467
**************************************

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