[16771] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4183 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 30 21:05:24 2000

Date: Wed, 30 Aug 2000 18:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <967683910-v9-i4183@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 30 Aug 2000     Volume: 9 Number: 4183

Today's topics:
         libgdbm.so.2 not found <flynhi@gte.net>
    Re: Bulk add to a hash.. Thanks for the help! (Jakob Schmidt)
    Re: Bulk add to a hash.. Thanks for the help! (Jakob Schmidt)
        Compiling Perl on Win32 (With Borland) <eyalb@aks.com>
        Connect to HP3000 using PERL ??? <raymond_w_yu@hp.com>
    Re: Getting slices of this ...(not pizza) <ren.maddox@tivoli.com>
    Re: Getting slices of this ...(not pizza) (Abigail)
    Re: help..I don't know what is this??? <lauren_smith13@hotmail.com>
    Re: help..I don't know what is this??? <hmerrill@my-deja.com>
    Re: How to launch a windows application from my script? <rocket@acme.com>
    Re: How to use a template with perl --- novice question <agustinchernitsky@altavista.com>
    Re: How to use a template with perl --- novice question (Martien Verbruggen)
    Re: interchanging variables <ren.maddox@tivoli.com>
    Re: interchanging variables (Abigail)
    Re: libgdbm.so.2 not found (Martien Verbruggen)
    Re: output fun <ren.maddox@tivoli.com>
    Re: Parse::RecDescent, lookahead, and optional subrules (Damian Conway)
    Re: Partner Required. Perl Programmer (Tony L. Svanstrom)
        PerlXS Makefile.pl <umrigas@cc.umanitoba.ca>
        Q. relating to  perlfaq(4) / sort <gorbeast@SPAMSUCKS.subduction.org>
    Re: Q. relating to  perlfaq(4) / sort <ren.maddox@tivoli.com>
    Re: Q. relating to  perlfaq(4) / sort <lr@hpl.hp.com>
    Re: Q. relating to  perlfaq(4) / sort <abe@ztreet.demon.nl>
    Re: Removing portions of arrays. <abe@ztreet.demon.nl>
    Re: timelocal() is wrong? <abe@ztreet.demon.nl>
    Re: timelocal() is wrong? <jjk@onlink.net>
        Tricking STDIN <mike@hulenbend.net>
    Re: Tricking STDIN (Malcolm Dew-Jones)
    Re: Tricking STDIN <Jonathan.L.Ericson@jpl.nasa.gov>
    Re: Trouble Reading From Database File... (Martien Verbruggen)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 30 Aug 2000 22:15:24 GMT
From: "flynhi" <flynhi@gte.net>
Subject:  libgdbm.so.2 not found
Message-Id: <0Ifr5.3107$En4.215661@dfiatx1-snr1.gtei.net>

I installed the pre-built package of perl for Solaris 2.7, and received this
error when just typing "perl" on the command line.  I saw a question posted
a couple of weeks ago similar to this, but no answer on deja.  If anybody
knows the fix, I'd like to hear it.




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

Date: Thu, 31 Aug 2000 00:52:24 +0200
From: sumus@aut.dk (Jakob Schmidt)
Subject: Re: Bulk add to a hash.. Thanks for the help!
Message-Id: <1eg7dpp.1lt5ejn1ay2zcmN@[192.168.88.117]>

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

> In article <1eg77nq.1n7gxnz1ykyfdqN@[192.168.88.117]> on Wed, 30 Aug 
> 2000 22:27:20 +0200, Jakob Schmidt <sumus@aut.dk> says...
> > Jakob Schmidt <sumus@aut.dk> wrote:
> >
> > make that /^\w+\z/
> 
> Even that isn't true.  Try 1x => 'foo' for example.

OH, that's just typical...

> Perhaps /^[^\W\d]\w*\z/  .
>
> I haven't worked with locales, so I don't know whether that might 
> include too many characters, and just ASCII letters should be used.

Why's it always so hard to be completely right :-)

-- 
Jakob


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

Date: Thu, 31 Aug 2000 00:52:24 +0200
From: sumus@aut.dk (Jakob Schmidt)
Subject: Re: Bulk add to a hash.. Thanks for the help!
Message-Id: <1eg7dsx.sod2erfpbi68N@[192.168.88.117]>

brian d foy <brian@smithrenaud.com> wrote:

> In article <1eg77nq.1n7gxnz1ykyfdqN@[192.168.88.117]>, sumus@aut.dk (Jakob
> Schmidt) posted:
> 
> > Jakob Schmidt <sumus@aut.dk> wrote:
> > 
> > > x => y is equivalent to "x", y (and "x" => y) for all x =~ /\w+/
> 
> don't you mean
> 
>    x => 'y'

Actually not but I can see that what I said is somewhat misleading.

I meant x and y to mean "whatever" (such as $var (hence the double
quotes), 'hello', why_me or 5) but then I'm in trouble if somebody
decides to generalize that to @ary or &get_key or $self->next_input_id

> remember that the bareword y is special ;)

hmmm - should've settled for strings as in the way you interpreted it.

Couldn't you say it like

xxx =>
is equivalent with
'xxx',

for xxx that are "sort of" single words (check that last bit with the
nearest Larry :-)

-- 
Jakob


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

Date: 31 Aug 2000 01:47:08 +0300
From: Eyal Ben-David <eyalb@aks.com>
Subject: Compiling Perl on Win32 (With Borland)
Message-Id: <m2zolu9xjn.fsf@eyalb_home.localdomain>


(Asked this several days ago. Hope someone will answer)

Hello,
  
First, I have a working perl (5.6.0) compiled with C++Builder 4.
I use it successfully in an application that embed Perl in a
C++Builder GUI. The backend compiler is BC++ 5.4 (from BCB 4)
I compiled successfully many CPAN modules (libwww, libnet, libw32 and more) 
  
The same sources fail to build correctly with BC++ 5.5(.1).
This compiler is available for free download. It is the backend
compiler for C++Builder 5 too. 
  
I could build the distribtion but many tests failed (90% okay.
In BC++ 5.4 It is 100% okay)
  
(Since the distribution support BC++, I think the latest compiler
should always be supported, especially a free compiler. I'm no
Perl guru but I can help ifm needed)
  
Did anyone succeeded with the BC++ 5.5?
Does anybody know if this compiler will be supported in future distribtions? 
  
Thanks
Eyal


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

Date: Wed, 30 Aug 2000 17:06:50 -0700
From: Raymond W Yu <raymond_w_yu@hp.com>
Subject: Connect to HP3000 using PERL ???
Message-Id: <39ADA19A.820062CB@hp.com>

Hi all,

I am trying to connect to a HP3000 MPE/ix system using PERL to automate
some tasks.

Is there a module that I can use to connect to the HP3000? 

I tried Net::Telnet and it doesn't work.  Then I tried telnet
hp3000-host 1537,
I got garbage.

I was able to use Reflection via OLE to connect to the HP3000, but the
performance is
very slow.

Any help or pointers will be appreciated.


Ray
650-236-5998


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

Date: 30 Aug 2000 16:56:05 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Getting slices of this ...(not pizza)
Message-Id: <m3snrm4dmy.fsf@dhcp11-177.support.tivoli.com>

kcivey@cpcug.org (Keith Calvert Ivey) writes:

> newsgroups@ckeith.clara.net (Colin Keith) wrote:
> >my($year) = (localtime(time()))[5];
> 
> Too much typing, and you're setting assigning a scalar to a list
> (which works in this case but isn't a good habit to get into).
> Try this:
> 
>     my $year = (localtime)[5];
> 
> Of course, as you've implied, that should probably be
> 
>     my $year = (localtime)[5] + 1900;

Are you sure that this is a scalar?  In particular, (localtime)[5,6]
is obviously a slice, so I expect (localtime)[5] is also a slice.

(I checked perldata, and the implication is that pulling a single
element from a list (not an array) is *not* a slice, but I was unable
to find an explicit statement either way.)

BTW, could someone clarify this bit from perldata for me:


       A slice of an empty list is still an empty list.  Thus:

           @a = ()[1,0];           # @a has no elements
           @b = (@a)[0,1];         # @b has no elements
           @c = (0,1)[2,3];        # @c has no elements

       But:

           @a = (1)[1,0];          # @a has two elements
           @b = (1,undef)[1,0,2];  # @b has three elements

In particular, I don't understand why "@a = (1)[1,0]" results in @a
having two elements rather than one.

The best I could come up with is that a list slice has magic that if
the slice is comprised entirely of undefs, then the result is an empty
list rather than a list of undefs, but if any of the resulting
elements are not undef, then all of the undefs are left in place.

So ()[1,0] becomes (undef, undef) becomes (), but (1)[1,0] becomes
(undef, 1) and stays that way.  Maybe???

Nope-- I just tried @a=(undef)[0], but @a gets one element.  So it
must be a little more subtle, some sort of "unexist" value or
something.... ()[1,0] becomes (unexist, unexist) becomes (), but
(1)[1,0] becomes (unexist, 1) becomes (undef, 1).  How does that
sound?

-- 
Ren Maddox
ren@tivoli.com


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

Date: 30 Aug 2000 23:57:40 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Getting slices of this ...(not pizza)
Message-Id: <slrn8qr7q2.8ac.abigail@alexandra.foad.org>

Ren Maddox (ren.maddox@tivoli.com) wrote on MMDLVI September MCMXCIII in
<URL:news:m3snrm4dmy.fsf@dhcp11-177.support.tivoli.com>:
== 
== 
== The best I could come up with is that a list slice has magic that if
== the slice is comprised entirely of undefs, then the result is an empty
== list rather than a list of undefs, but if any of the resulting
== elements are not undef, then all of the undefs are left in place.

Yeah, and it's documented that way.



Abigail
-- 
 :;$:=~s:
-:;another Perl Hacker
 :;chop
$:;$:=~y:;::d;print+Just.$:


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

Date: Wed, 30 Aug 2000 15:02:28 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: help..I don't know what is this???
Message-Id: <8ok05t$d1a$1@brokaw.wa.com>


<eduardo_m@my-deja.com> wrote in message news:8ojv7h$eb2$1@nnrp1.deja.com...
>
> I know how works this, but I want to know what the "$@" means...Is
> something like a way to know if an error has ocurred????....

You can find out about any of Perl's variables in the perlvar documentation.

$@ is also known as $EVAL_ERROR if that helps you spot it easier.

perldoc perlvar

Lauren
--
print grep ord $_,map{y/a-zA-Z//d;$x.="+ $_";chr(eval $x)}
'J74u43-s2tA1-84n33o45th1er5-12-P3e13-82r48l21H13-a6-76
c40k25er2wx8-y6z13-81'=~m#([^!\n]{3})#g#tr/-0-9//d;print




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

Date: Wed, 30 Aug 2000 22:13:12 GMT
From: Hardy Merrill <hmerrill@my-deja.com>
Subject: Re: help..I don't know what is this???
Message-Id: <8ok0t7$gek$1@nnrp1.deja.com>

In article <8ojv7h$eb2$1@nnrp1.deja.com>,
  eduardo_m@my-deja.com wrote:
> Hello everyone....
>
> I'm programming in DBI and I looked into several tutorials, and I have
> found one that says:
>
> $sth->execute();
>
> if ($@) {
>     $dbh->rollback();
> }
>
> I know how works this, but I want to know what the "$@" means...Is
> something like a way to know if an error has ocurred????....

DBI threads belong on the Perl DBI mailing list at dbi-users@isc.org.

You'll usually(always?) find the "if ($@) {" statement at the end of an
"eval" block - if any error or die occurs inside an eval, then the error
text goes into "$@", and control is transferred to the statement right
after the eval(usually to the "if ($@) {").

You can find out more about the eval block by doing

      perldoc -f eval

at the command line - that is assuming you have Perl installed :-)

You can get a boat-load of info on perl by starting with

      perldoc perldoc
      perldoc perl

HTH.

--
Hardy Merrill
Mission Critical Linux, Inc.
http://www.missioncriticallinux.com


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


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

Date: Wed, 30 Aug 2000 15:15:10 -0700
From: JakeRocket <rocket@acme.com>
Subject: Re: How to launch a windows application from my script?
Message-Id: <2CF807F2B237E660.A877A58E2734CCAD.71AA441C7DFD758D@lp.airnews.net>

thanks for the tip

-Jeff


On Wed, 30 Aug 2000 14:47:29 -0700, "Lauren Smith"
<lauren_smith13@hotmail.com> wrote:

>
>JakeRocket <rocket@acme.com> wrote in message
>news:BC1F83528AD55F84.B078699A8D8408B8.83BAFFCDD98160BC@lp.airnews.net...
>> I'm working exclusively in a Win32 environment, so keep that in mind.
>> I am writing to an Output file that I want to launch in Windows
>> Notepad as soon as my script is done.  Does perl support this, and if
>> so how?
>
>#!perl -w
>system ("notepad.exe");
>
>or alternatively,
>
>exec ("notepad.exe");
>
>See the documentation for exec() and system().  Type the following lines
>into your command window:
>
>perldoc -f system
>perldoc -f exec
>
>Lauren



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

Date: Wed, 30 Aug 2000 20:31:11 -0300
From: "Agustin Chernitsky" <agustinchernitsky@altavista.com>
Subject: Re: How to use a template with perl --- novice question
Message-Id: <8ok5il$b0ag8$1@ID-48235.news.cis.dfn.de>

Hi Brian,

    What's that of CPAN?? Were can I get it?

Thanks!
"brian d foy" <brian@smithrenaud.com> wrote in message
news:brian-ya02408000R3008001638520001@news.panix.com...
In article <8ojqfe$assfo$1@ID-48235.news.cis.dfn.de>, "Agustin Chernitsky"
<agustinchernitsky@altavista.com> posted:

> "brian d foy" <brian@smithrenaud.com> wrote in message
> news:brian-ya02408000R3008001620020001@news.panix.com...

> In article <39AD623B.8DBB13C6@shentel.net>, Albert Dewey
> <timewarp@shentel.net> posted:

> > First load the entire template in a variable,

> that could take up a lot of memory. you should consider if you really
> need to do that to accomplish the task (you probably don't).

> This is interesting. Brian, what other solution then?

read the file line-by-line or use a stream parser.  of course,
this is a pain to code, so you could use one of the myriad
templating systems on CPAN instead.

--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>




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

Date: Thu, 31 Aug 2000 00:11:43 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: How to use a template with perl --- novice question
Message-Id: <slrn8qr8ld.2cp.mgjv@verbruggen.comdyn.com.au>

[Please, in the future, put your reply _after_ the suitably shortened
text you reply to. It makes it easier to read the whole post, as it is
more natural that way.]

On Wed, 30 Aug 2000 20:31:11 -0300,
	Agustin Chernitsky <agustinchernitsky@altavista.com> wrote:
[reordered and cut down post]
> "brian d foy" <brian@smithrenaud.com> wrote in message
> news:brian-ya02408000R3008001638520001@news.panix.com...
> 
>> read the file line-by-line or use a stream parser.  of course,
>> this is a pain to code, so you could use one of the myriad
>> templating systems on CPAN instead.
> 
>     What's that of CPAN?? Were can I get it?

Start at http://www.cpan.org/

Have a look at the modules list there.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | +++ Out of Cheese Error +++ Reinstall
Commercial Dynamics Pty. Ltd.   | Universe and Reboot +++
NSW, Australia                  | 


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

Date: 30 Aug 2000 16:31:49 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: interchanging variables
Message-Id: <m3ya1e4ere.fsf@dhcp11-177.support.tivoli.com>

Bart Lateur <bart.lateur@skynet.be> writes:

> Ankur Banerjee wrote:
> 
> >How do i interchange values of three variables $a,$b,$c WITHOUT  using
> >this expression:-
> >($a,$b,$c)=($b,$c,$a);
> 
> Well, that is the Perl way. Any other way can be done in almost any
> language.
> 
> This might work if all are integersor equal length strings:
> 
> 	($a, $b, $c) = (4, 1, 2);
> 	# ($a, $b, $c) = ("baz", "foo", "bar");
> 	print "We have: $a $b $c\n";
> 	print "We want: $b $c $a\n";
> 	$b ^= $c;
> 	$c ^= $a;
> 	$a ^= $b;
> 	$a ^= $c;
> 	$b ^= $a;
> 	$c ^= $b;
> 	print "We got:  $a $b $c\n";

Actually, I believe (and some testing and "perldoc perlop" seem to
bear out) that there is no requirement for the strings to be of equal
length.

Here is a section of perlop:

       Bitwise String Operators

       Bitstrings of any size may be manipulated by the bitwise
       operators (`~ | & ^').

       If the operands to a binary bitwise op are strings of
       different sizes, | and ^ ops act as though the shorter
       operand had additional zero bits on the right, while the &
       op acts as though the longer operand were truncated to the
       length of the shorter.  The granularity for such extension
       or truncation is one or more bytes.

Also, I'm a teeny bit confused by your choice of order for the XOR
operations.  I would think that this would be an easier to understand
order (though perhaps I'm missing something):

#!/usr/local/bin/perl -w
use strict;
my($a, $b, $c) = qw(bazsdf foox bar);

print "We have: $a $b $c\n";
print "We want: $b $c $a\n";

# First, realize that ($a, $b, $c) = ($b, $c, $a) can be broken
# down into ($a, $b) = ($b, $a) and ($b, $c) = ($c, $b)

$a ^= $b; $b ^= $a; $a ^= $b;    # swap $a and $b
$b ^= $c; $c ^= $b; $b ^= $c;    # now swap the new $b with $c

print "We got : $a $b $c\n";
__END__

-- 
Ren Maddox
ren@tivoli.com


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

Date: 31 Aug 2000 00:10:20 GMT
From: abigail@foad.org (Abigail)
Subject: Re: interchanging variables
Message-Id: <slrn8qr8hq.8ac.abigail@alexandra.foad.org>

Ren Maddox (ren.maddox@tivoli.com) wrote on MMDLVI September MCMXCIII in
<URL:news:m3ya1e4ere.fsf@dhcp11-177.support.tivoli.com>:
## 
## #!/usr/local/bin/perl -w
## use strict;
## my($a, $b, $c) = qw(bazsdf foox bar);
## 
## print "We have: $a $b $c\n";
## print "We want: $b $c $a\n";
## 
## # First, realize that ($a, $b, $c) = ($b, $c, $a) can be broken
## # down into ($a, $b) = ($b, $a) and ($b, $c) = ($c, $b)
## 
## $a ^= $b; $b ^= $a; $a ^= $b;    # swap $a and $b
## $b ^= $c; $c ^= $b; $b ^= $c;    # now swap the new $b with $c
## 
## print "We got : $a $b $c\n";
## __END__


Nice try, but you're fooling yourself.

    #!/opt/perl/bin/perl -w
    use strict;
    my($a, $b, $c) = qw(bazsdf foox bar);

    printf "We have: $a (%d) $b (%d) $c (%d)\n", map {length} $a, $b, $c;
    printf "We want: $b (%d) $c (%d) $a (%d)\n", map {length} $b, $c, $a;

    # First, realize that ($a, $b, $c) = ($b, $c, $a) can be broken
    # down into ($a, $b) = ($b, $a) and ($b, $c) = ($c, $b)

    $a ^= $b; $b ^= $a; $a ^= $b;    # swap $a and $b
    $b ^= $c; $c ^= $b; $b ^= $c;    # now swap the new $b with $c

    printf "We got : $a (%d) $b (%d) $c (%d)\n", map {length} $a, $b, $c;
    __END__
    We have: bazsdf (6) foox (4) bar (3)
    We want: foox (4) bar (3) bazsdf (6)
    We got : foox (6) bar (6) bazsdf (6)

NUL characters don't show up easily on a terminal - but they are still there.


Abigail
-- 
map{${+chr}=chr}map{$_=>$_^ord$"}$=+$]..3*$=/2;        
print "$J$u$s$t $a$n$o$t$h$e$r $P$e$r$l $H$a$c$k$e$r\n";


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

Date: Wed, 30 Aug 2000 23:16:18 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: libgdbm.so.2 not found
Message-Id: <slrn8qr5df.2cp.mgjv@verbruggen.comdyn.com.au>

On Wed, 30 Aug 2000 22:15:24 GMT,
	flynhi <flynhi@gte.net> wrote:

\begin{offtopic}

It isn't really a Perl issue, but a general software installation
issue.

> I installed the pre-built package of perl for Solaris 2.7, and received this

'the' pre-built package? I suspect there are several.

> error when just typing "perl" on the command line.  I saw a question posted
> a couple of weeks ago similar to this, but no answer on deja.  If anybody
> knows the fix, I'd like to hear it.

To repeat the error in the body of the message (and not just in the
subject) is always a good thing to do on Usenet:

> libgdbm.so.2 not found

The prebuilt package that you got was linked and built against the GNU
dbm implementation. You'll have to compile and install it (as a shared
library) or download another prebuilt package for it. If it is already
installed, make sure that your runtime linker can find the shared
library (by changing your LD_LIBRARY_PATH environment variable, or by
doing other things to your runtime linker's configuration. I believe
that you can't on Solaris 7; On 8 you can change the search path for
the linker in a system wide configuration file)

You can do a web search to find the source for gdbm, or use
www.sunfreeware.com or smc.vnet.net to download precompiled binaries.

\end{offtopic}

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Hi, John here, what's the root
Commercial Dynamics Pty. Ltd.   | password?
NSW, Australia                  | 


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

Date: 30 Aug 2000 16:40:03 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: output fun
Message-Id: <m3vgwi4edo.fsf@dhcp11-177.support.tivoli.com>

kcivey@cpcug.org (Keith Calvert Ivey) writes:

> Uri Guttman <uri@sysarch.com> wrote:
> 
> >$_="ABCDEFGFEDCBA\n";print;print while y/G/ /||s/.( +)\S/ $1 /g;
> 
>  $_="ABCDEFGFEDCBA\n";print,s/G|(?<= ).|.(?= )/ /g while/\S/;
> 
> Four strokes shorter, and avoids printing the extra blank line.

   $_="ABCDEFGFEDCBA\n";print,s/.( +)./ $1 /,s/G/ /while/\S/;

Two strokes shorter.

Just for fun, here's a version that takes arguments for the range.  Of
course, it doesn't do any argument checking, so it will seriously
break if given unexpected arguments.  (Expected being two characters
that work together with the range operator, i.e. both in the same of
the following ranges 0..9, a..z, A..Z)

perl -le '$_=join "",shift..($Z=shift);$_.=reverse;s/$Z//;
print,s/.( +)./ $1 /,s/$Z/ /while/\S/' A G

-- 
Ren Maddox
ren@tivoli.com


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

Date: 31 Aug 2000 00:58:22 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Parse::RecDescent, lookahead, and optional subrules.
Message-Id: <8okaje$khn$1@towncrier.cc.monash.edu.au>

Omri Schwarz <ocschwar@mit.edu> writes:

>What is the proper way to do...


	foo: bar (...baz)(?)
		{ if (@{$item[2]}) { print "there's a baz ahead\n"; }
		  else             { print "there's no baz ahead\n"; }
		}


Damian


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

Date: Thu, 31 Aug 2000 01:06:25 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: Partner Required. Perl Programmer
Message-Id: <1eg7f1n.1ghta0fvi75fbN%tony@svanstrom.com>

Paul Eckert <peckert@epicrealm.com> wrote:

> Rob wrote:
> > 
> > Sorry uRi.
> > Your are not qualified enough.
> > A "relaxed easy going attitude" is a key requirement.
> 
> Did you catch that, Uri?  Not only do they want to offer nothing, but
> they don't want you to complain, either.  This is sure a good deal for
> somebody :).  Maybe the troll?
> 
> Rob, try emailing your request to: callgirl@la.znet.com 

I gotta ask, whom would get that e-mail? *L*


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
   on the verge of frenzy - i think my mask of sanity is about to slip
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©99-00 <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: Wed, 30 Aug 2000 17:19:56 -0500
From: Nektarios Rigas <umrigas@cc.umanitoba.ca>
Subject: PerlXS Makefile.pl
Message-Id: <39AD888C.D4D4DA46@cc.umanitoba.ca>

I am  having trouble with loading the wsock32.lib into a perlXS
makefile.pl

Its either not loading it, or if it is loading, something is incorrect,
The C++ code is not able to use the socket library.

I've run and tested the C++ code one its own, with its own Makefile,
manually loading the library, and it works perfectly fine.
Using the same C++ code called from a perlsXS subrountine and it returns
, send failed.

Makefiles is not my strong suit, and I've changed mine so many times
that it's not worth
cutting and pasting into this posting.  Please send me a sample
makefile.pl that
imports(links) libraries properly into a plerxs makefile.

============================
Thank You

          N. Rigas
          Email: nrigas2@home.com
          Phone: (204)885-2910
          Office: (204)885-555 ext. 281




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

Date: Wed, 30 Aug 2000 15:15:51 -0700
From: Gorbeast <gorbeast@SPAMSUCKS.subduction.org>
Subject: Q. relating to  perlfaq(4) / sort
Message-Id: <39AD8797.4DFB0D69@SPAMSUCKS.subduction.org>

Hi,

I can't tell from reading the documentation in perlfaq(4) if the
Schwartzian Transformation a solution to the following scenario.  If you
can confirm or deny this, I'd appreciate it.  If it is not, a nudge in
the right direction would be very appreciated.

This stands for a text file that has columns of numbers:	

column1	column2 column3 column4
column1	column2 column3 column4
column1	column2 column3 column4
column1	column2 column3 column4
column1	column2 column3 column4
 ...

My desired outcome is for each line to be ordered in by column 2, in
order of greatest -> least.  My personal skill level lets me devise a
solution where column 2 gets ordered from greatest to least, but not
couhed within the other columns.  Is the Schwartzian Transformation how
I do this? 

Please advise, thanks ...G


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

Date: 30 Aug 2000 18:00:00 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Q. relating to  perlfaq(4) / sort
Message-Id: <m3pumq4aof.fsf@dhcp11-177.support.tivoli.com>

Gorbeast <gorbeast@SPAMSUCKS.subduction.org> writes:

> Hi,
> 
> I can't tell from reading the documentation in perlfaq(4) if the
> Schwartzian Transformation a solution to the following scenario.  If you
> can confirm or deny this, I'd appreciate it.  If it is not, a nudge in
> the right direction would be very appreciated.
> 
> This stands for a text file that has columns of numbers:	
> 
> column1	column2 column3 column4
> column1	column2 column3 column4
> column1	column2 column3 column4
> column1	column2 column3 column4
> column1	column2 column3 column4
> ...
> 
> My desired outcome is for each line to be ordered in by column 2, in
> order of greatest -> least.  My personal skill level lets me devise a
> solution where column 2 gets ordered from greatest to least, but not
> couhed within the other columns.  Is the Schwartzian Transformation how
> I do this? 

A Schwartzian Transform (or better yet, a Guttman-Rosler Transform) is
simply a way to improve (dramatically) the efficiency of a sort.  But
first, you need to formulate the basic sort.

In this case, I believe you are looking for something like:

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

my @data = <DATA>;
print reverse sort {
   my @a_flds = split ' ', $a;
   my @b_flds = split ' ', $b;
   $a_flds[1] <=> $b_flds[1]
} @data;

__DATA__
123 234 345 456
231 456 789 999
321 345 567 789


After a suitable GRT, you probably end up with something like:

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

my @data = <DATA>;
print reverse map {
   substr $_, rindex $_, "\0"
} sort map {
   pack "A*xA*", (split)[1], $_
} @data;

__DATA__
123 234 345 456
231 456 789 999
321 345 567 789


-- 
Ren Maddox
ren@tivoli.com


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

Date: Wed, 30 Aug 2000 16:53:46 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Q. relating to  perlfaq(4) / sort
Message-Id: <MPG.14173e6461988b2598ad08@nntp.hpl.hp.com>

In article <m3pumq4aof.fsf@dhcp11-177.support.tivoli.com> on 30 Aug 2000 
18:00:00 -0500, Ren Maddox <ren.maddox@tivoli.com> says...

 ...
 
> A Schwartzian Transform (or better yet, a Guttman-Rosler Transform) is
> simply a way to improve (dramatically) the efficiency of a sort.  But
> first, you need to formulate the basic sort.
> 
> In this case, I believe you are looking for something like:
> 
> #!/usr/local/bin/perl -w
> use strict;
> 
> my @data = <DATA>;
> print reverse sort {
>    my @a_flds = split ' ', $a;
>    my @b_flds = split ' ', $b;
>    $a_flds[1] <=> $b_flds[1]
> } @data;
> 
> __DATA__
> 123 234 345 456
> 231 456 789 999
> 321 345 567 789

Needn't 'reverse' if you switch $a... and $b... in the comparison.

> After a suitable GRT, you probably end up with something like:
> 
> #!/usr/local/bin/perl -w
> use strict;
> 
> my @data = <DATA>;
> print reverse map {
>    substr $_, rindex $_, "\0"
> } sort map {
>    pack "A*xA*", (split)[1], $_
> } @data;
> 
> __DATA__
> 123 234 345 456
> 231 456 789 999
> 321 345 567 789

There is a small error in the extraction (1 + rindex...), and you 
switched from numerical to alphabetic sort (which doesn't matter for 
this data set, but would matter if the numbers don't have exactly the 
same number of digits).

Numerical sorts are done with either a pack-N or a sprintf'ed sortkey.

  print reverse map {
     substr $_, 4
  } sort map {
     pack 'NA*' => (split)[1], $_
  } @data;

  print reverse map {
     substr $_, 10
  } sort map {
     sprintf '%.10u%s' => (split)[1], $_
  } @data;

In each case, the sortkeys may be shortened if the maximum integer is 
restricted.  The shorter the sortkey, the faster the sort; but this is a 
small effect.

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


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

Date: Thu, 31 Aug 2000 02:09:08 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Q. relating to  perlfaq(4) / sort
Message-Id: <0a7rqs0u8d50j9nk2t6k8i81v43e7mqhvp@4ax.com>

On 30 Aug 2000 18:00:00 -0500, Ren Maddox <ren.maddox@tivoli.com> wrote:

 ...
> After a suitable GRT, you probably end up with something like:
          ^^^^^^^^

> 
> #!/usr/local/bin/perl -w
> use strict;
> 
> my @data = <DATA>;
> print reverse map {
>    substr $_, rindex $_, "\0"
> } sort map {
>    pack "A*xA*", (split)[1], $_
> } @data;
> 
> __DATA__
> 123 234 345 456
> 231 456 789 999
> 321 345 567 789

Nope, add the next line to your data:

	321  45 567 789

If you want to sort numbers, use a numerical pack() format.

	my @sorted = map substr($_, 4) => sort
		map pack(N => -(split)[1]) . $_ => @data;

For more information: "A Fresh Look at Efficient Perl Sorting" 
(Apendix B:)

	http://www.hpl.hp.com/personal/Larry_Rosler/sort/sorting.html

-- 
Good luck,
Abe

##
%_ = reverse (tsuJ=>0, rehtona=>1, lreP=>2, rekcah=>3);
@_ = reverse map { ($_{$_}, $_) } sort keys %_;
$_ = reverse join " ", map $_[$_] => grep $_%2 => 0..$#_;
print


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

Date: Thu, 31 Aug 2000 00:17:48 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Removing portions of arrays.
Message-Id: <sb1rqs440pvnt45a6pergca7athq0jru2c@4ax.com>

On Wed, 30 Aug 2000 13:18:21 -0700, Tim Conrow <tim@ipac.caltech.edu>
wrote:

> johnvert@my-deja.com wrote:
> > I want to remove portions of text which are scattered line by line over
> > a certain array.  For example, if I have a file containing:
> > 
> > one
> > two
> > three
> > four
> > five
> > 
> > After it has been read into an array, I would want to remove all the
> > lines between `one' and `four'.
> 
> Look at perlop and understand how the '..' range operator actually works;
> there're examples which you can lift almost exactly. Also read perlre again and
> see that '/a .. b/' has *nothing* to do with the range operator.
> 
> perl -wne 'print if /^one/../^four/' test-file

Well, that doesn't really do what OP asked for...

This will work on the sample data:

	my @foo = qw(one two three four five);
	print "$_\n" for 
		grep !(/one/../four/)||/one/||/four/ => @foo;

But maybe splice() could do the job. Hard to say without real data and a
real problem.

-- 
Good luck,
Abe

##
perl -wle '$_=q@Just\@another\@Perl\@hacker@;print qq@\@{[split/\@/]}@'


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

Date: Thu, 31 Aug 2000 01:20:43 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: timelocal() is wrong?
Message-Id: <ah5rqs4agqsplklu0od805b2i0nkrtg7du@4ax.com>

On Wed, 30 Aug 2000 15:59:45 -0400, "Jonah" <jjk@onlink.net> wrote:

> Why does this return a value?
> 
> my $seconds = timelocal(0, 0, 0, 31, 1, 100);
> 
> This is February 31st, 2000 and...
> there's no such thing!
> 
> Shouldn't I be getting a -1 value, or some sort of
> indication that this is an error?
> 
> ...and get this, here are the values I get
> from feb 29 - 951811200
> to feb 31 (midnight) - 952070399
> 
> So does this mean that the seconds for March 1st are off?
> It keeps adding seconds as if feb 30 and feb 31st count as days...


perl -MTime::Local -le 'print scalar localtime timelocal 0,0,0,31,1,100'

-- 
Good luck,
Abe

##
perl -wle '$_=q@Just\@another\@Perl\@hacker@;print qq@\@{[split/\@/]}@'


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

Date: Wed, 30 Aug 2000 18:06:17 -0400
From: "Jonah" <jjk@onlink.net>
Subject: Re: timelocal() is wrong?
Message-Id: <8ok75i$enk$1@onlink3.onlink.net>

well slap me stupid,

print scalar localtime timelocal 0,0,0,31,1,100;

output: Sat Mar 2 00:00:00 2000

print scalar localtime timelocal 0,0,0,35,1,100;

output: Mon Mar 6 00:00:00 2000

DUH!

thanks Abe

>
> > Why does this return a value?
> >
> > my $seconds = timelocal(0, 0, 0, 31, 1, 100);
> >
> > This is February 31st, 2000 and...
> > there's no such thing!
> >
> >
> > ...and get this, here are the values I get
> > from feb 29 - 951811200
> > to feb 31 (midnight) - 952070399
> >
> > So does this mean that the seconds for March 1st are off?
> > It keeps adding seconds as if feb 30 and feb 31st count as days...
>
>
> perl -MTime::Local -le 'print scalar localtime timelocal 0,0,0,31,1,100'
>
> --





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

Date: Wed, 30 Aug 2000 17:07:33 -0500
From: "mike" <mike@hulenbend.net>
Subject: Tricking STDIN
Message-Id: <8ok0kp$5rs4@news1.lmtas.lmco.com>

I am trying to create a text string and then when I call <stdin>, i want to
read that string.

so the string would be something like:

my $tmpstring = "some text ^D";

#some code here to direct the string to <stdin>. I don't know the slighest
what it would be, maybe a post

when I run ftp I want to read the string instead of a file I use Net::FTP
and Net::Cmd.

$ftp->put("-","tmp.txt");  <-this reads for <stdin> until it receives ^D.

The result is that instead of moving text from a physical file on the
harddisk to a file on another machine, I can read from mySQL and then write
the string to a file on another machine.

Any help appreciated.

Mike





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

Date: 30 Aug 2000 16:23:08 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Tricking STDIN
Message-Id: <39ad975c@news.victoria.tc.ca>

mike (mike@hulenbend.net) wrote:
: I am trying to create a text string and then when I call <stdin>, i want to
: read that string.

TIEHANDLE might help.  Read perltie.pod

	perldoc perltie



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

Date: Wed, 30 Aug 2000 16:30:00 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Tricking STDIN
Message-Id: <39AD98F8.BCCAC8F5@jpl.nasa.gov>

mike wrote:
> my $tmpstring = "some text ^D";
> 
> #some code here to direct the string to <stdin>. I don't know the slighest
> what it would be, maybe a post
> 
> when I run ftp I want to read the string instead of a file I use Net::FTP
> and Net::Cmd.
> 
> $ftp->put("-","tmp.txt");  <-this reads for <stdin> until it receives ^D.

$ perl -e 'open STDIN, "echo some text |" or die $!; print <STDIN>'
some text
$

(I don't use Net::FTP, so I won't pretend this is the right solution,
just a cool open trick.)

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King


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

Date: Wed, 30 Aug 2000 22:19:42 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: Trouble Reading From Database File...
Message-Id: <slrn8qr23k.2cp.mgjv@verbruggen.comdyn.com.au>

On Wed, 30 Aug 2000 11:00:43 -0700,
	Larry Rosler <lr@hpl.hp.com> wrote:
> In article <slrn8qotlq.ra.mgjv@verbruggen.comdyn.com.au> on Wed, 30 Aug 
> 2000 03:52:03 GMT, Martien Verbruggen <mgjv@verbruggen.comdyn.com.au> 
> says...
> 
> ...
> 
> > while (my $line = <DATA>)
> > {
> > 	my ($username,$password) = split(/\|/, $line);
> > 	if ($user_name eq $username)
> > 	{
> > 		login();
> > 	} 
> > 	else 
> > 	{
> > 		home();
> > 	}
> > }
> 
> Some like their coding vertical.  I prefer horizontal:
> 
>   (split /\|/)[0] eq $user_name ? login() : home() while <DATA>;
> 
> One can see a lot more code in a given screenful.  Assuming that's a 
> Good Thing (TM).

I'd probably code part of it horizontally as well, in this particular
case.  But in didactic mode I tend to fall back to vertical mode, just
because it is easier to parse for people who aren't as familiar with
Perl. I probably wouldn't combine the whole thing though. Especially
not if I expected that more code would be added down the track that
might actually _use_ password :)

Martien
-- 
Martien Verbruggen              | My friend has a baby. I'm writing
Interactive Media Division      | down all the noises the baby makes so
Commercial Dynamics Pty. Ltd.   | later I can ask him what he meant -
NSW, Australia                  | Steven Wright


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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


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


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