[6383] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 25 01:07:16 1997

Date: Mon, 24 Feb 97 22:00:19 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 24 Feb 1997     Volume: 8 Number: 8

Today's topics:
     Re: Built-in variable for loop iteration#? <rootbeer@teleport.com>
     Datestr <=> sec_since_1970 conversion <ltw@arraycomm.com>
     Difficulties making Cryptix-Perl 1.1b (Brian Vickers)
     Re: floating point -> hex ?? <rootbeer@teleport.com>
     Re: forwarding a mail message with PERL (Kevin Johnson)
     Re: Generating a randomly sorted list of integers <rootbeer@teleport.com>
     Re: help: syntax error for "}" <rootbeer@teleport.com>
     Re: help: syntax error for "}" (Piotr Piatkowski)
     Re: How to spam - legitimately (Mike Stok)
     Re: How to spam - legitimately (Mike Stok)
     Re: How to spam - legitimately <rootbeer@teleport.com>
     Re: How to spam - legitimately (Joshua Lerner)
     Re: html -> text <rootbeer@teleport.com>
     Re: incremented scalar names, is it possible? (Chaim Frenkel)
     memory leak in HTML::LinkExtor (Matthew Ahrens)
     Re: Multiple values to/from subroutines... (Piotr Piatkowski)
     Need PERL script for web site to track activity (Arlyn K. Chesley)
     Re: References_>Faster? <roderick@gate.net>
     Re: Simple pack problem that I can not figure out <rootbeer@teleport.com>
     Re: Simple pack problem that I can not figure out <billc@tibinc.com>
     Re: Trying to understand regex's (Piotr Piatkowski)
     Re: uc without explicit argument inside map. Bug? <rootbeer@teleport.com>
     Re: Variable interpolation with s/// operator <rpsavage@ozemail.com.au>
     Why do I keep getting segmentation faults? <stats9@mail.idt.net>
     Win32::NetAdmin <jrtietsort@micron.com>
     Re: Yet another desirable pack format: (was re: Strange <roderick@gate.net>
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: Mon, 24 Feb 1997 18:42:13 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "Michael N. Edmonson" <edmonson@yulara.fccc.edu>
Subject: Re: Built-in variable for loop iteration#?
Message-Id: <Pine.GSO.3.95q.970224184004.12031N-100000@kelly.teleport.com>

On 24 Feb 1997, Michael N. Edmonson wrote:

> I'm wondering if there's a built-in "counter" variable somewhere in
> Perl that will tell me number of the current iteration of a loop.  I
> find myself writing code like:
> 
>   my $i=0;
>   foreach (@array) {
>     # do something with $_ and $i++
>   } 

Why not this instead?

    for (0..$#array) {
        # Do something with $array[$_]
    }

Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Tue, 25 Feb 1997 03:40:28 GMT
From: Loh Thiam Wah <ltw@arraycomm.com>
Subject: Datestr <=> sec_since_1970 conversion
Message-Id: <33125F2C.41C67EA6@arraycomm.com>

It is possible to convert from a str of minute, second, hour, day, month
& year back to the value normally returned by time ?

Thanks
ltw


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

Date: Mon, 24 Feb 1997 19:59:15 -0900
From: Brian.R.Vickers@jpl.nasa.gov (Brian Vickers)
Subject: Difficulties making Cryptix-Perl 1.1b
Message-Id: <Brian.R.Vickers-ya02408000R2402971959150001@news.jpl.nasa.gov>

HI. I'm having a bit of difficulty making Cryptix-Perl 1.1b. Here are the
pertinent errors from running the make:

Rebuilding Crypt-MD5/Makefile ...
Checking if your kit is complete...
Looks good
'XSPROTOARG' is not a known MakeMaker parameter name.

[...]

Rebuilding Crypt-Systemics/Makefile ...
Checking if your kit is complete...
Warning: the following files are missing in your kit:
        Changes
        Crypt/Blowfish.pod
        Crypt/DES.pod
        Crypt/IDEA.pod
Please inform the author.

[...]

Rebuilding Math-Systemics/Makefile ...
Checking if your kit is complete...
Warning: the following files are missing in your kit:
        Math/BigInteger.pod
        Math/PRSG.pod
        Math/TrulyRandom.pod
Please inform the author.

all of which results in the following

Running Mkbootstrap for Cryptix ()
        chmod 644 Cryptix.bs
        LD_RUN_PATH="" ld -o ./blib/auto/Cryptix/Cryptix.sl -b Cryptix.o
ld: Can't open Cryptix.o
ld: No such file or directory   
*** Error code 1

Now I realize that according to the CHANGES files that messages about pods
are suppose to be "no big drama" but I'm concerned about the XSPROTOARG
error and the fact that I can't get it to make at all.

Has anyone else seen this or have any inputs as to what I can do to get
this going?

-- 
Brian Vickers
brian.r.vickers@jpl.nasa.gov
 .sig-less


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

Date: Mon, 24 Feb 1997 18:19:16 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Steve Smith <ssmith@nine.com>
Subject: Re: floating point -> hex ??
Message-Id: <Pine.GSO.3.95q.970224172227.12031I-100000@kelly.teleport.com>

On 24 Feb 1997, Steve Smith wrote:

> I would like to represent a single precision floating-point value as
> a hexidecimal number (ie 8-bit hex), but I'm not having any luck.

What's 8-bit hex? I've never heard of that. Every hex digit I've seen
encodes four bits. Or are these pairs of hex digits you're talking about? 

> I've tried 
>  1)  sprintf ("%x", $num)

That should give you the hex representation of the integer part.

>  2)  various tries with unpack 

If you used the right formats, and threw in a pack, that will do basically
the same. 

> Is there a trick to using unpack?  It's yielding unexpected results....

The trick is to expect what's actually going to happen. :-)  But if you
can give some sample code, we might be able to tell you what to expect
from it.

> Also, it only yields a 1-bit hex number for some reason....

One-bit hex? I had a hard enough time figuring out eight-bit hex!  :-) 

I suspect that you want to be able to print out a number in base-16, not
unlike how you can now print it in base-10. Is that it?

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 24 Feb 1997 20:13:06 -0700
From: kjj@primenet.com (Kevin Johnson)
Subject: Re: forwarding a mail message with PERL
Message-Id: <5etlc2$5r9@nnrp1.news.primenet.com>

Geert Nijs <geert.nijs@fys.kuleuven.ac.be> wrote:
>I want to forward a mail message to another account using perl.
>
>The mail arrives at a Linux account and is transfered to
>a PERL Script. (this was easy).
>
>This PERL script can examine the mail by reading STDIN, but this is
>not necessary. What I want to do is the following:
>  just forward everything (that can be read from STDIN) to 
>  another e-mail account (so: without changing any of the headers)

>From your description, a simple .forward file merely containing the
email address you want to forward to would suffice...

-- 
thx,
kjj@pobox.com   http://www.pobox.com/~kjj/


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

Date: Mon, 24 Feb 1997 20:41:10 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Stephen Frost <frostbyt@shell01.ozemail.com.au>
Subject: Re: Generating a randomly sorted list of integers
Message-Id: <Pine.GSO.3.95q.970224201746.24027C-100000@kelly.teleport.com>

On 24 Feb 1997, Stephen Frost wrote:

> I needed to write some code to produce a randomly sorted list of
> integers (between "1" and "n").  This I have done, but I am not
> at all happy with the amount of code that was required, nor with
> the performance implications of the way I've gone about it.  It
> works just dandy (and fast enough) with 1->99 or thereabouts, but
> if I were to use it with 1->999 or 1->9999 it would probably die
> a horrible death.

There has to be some upper bound, of course, since you are asking perl to
keep track of a long list of integers. But I think you can go a little
further than 9999 without too much trouble. 

> Perhaps someone might suggest an alternative approach to mine?  I
> set up an array containing a "0" for each integer required, and then
> set it to "1" as each number in the range is used, pushing the
> new number onto my list as I go.  

So, when you're trying to get that last number, you have to keep calling
rand over and over again to try to hit it? Ouch! Why not simply keep a
list of the numbers you haven't used yet? (See following subroutine.)

>    $random = srand(time);

I don't think that's doing what you think it's doing. In most cases, a
simple 'srand;' is plenty, though.

>    for ($x = 1; $x < ($high + 1); $x++) {

No doubt you meant to write this. :-)  Perl does a lot to make your life
easier, no?

   for $x (1..$high) {

>       $USED{"$x"} = '0';

Those quote marks are unneeded, but they don't hurt your code any. Those
other quote marks are unneeded, but they don't hurt your code any. :-)

>       while (1 == 1) {

If you really need an infinite loop, 'while (1)' is enough. But Perl
internally optimizes what you wrote into an infinite loop, so it's only
wasted typing.

> but go easy on me won't you?  I am, after all, merely a born-again COBOL
> programmer... 

Okay, I'll stop picking on your code. :-)  Here's a subroutine which can
do what I think you're looking for. Be sure to call srand just once, near
the start of your script. This routine can supply a random list of 10,000
elements in about 2.1 seconds on my machine, but your mileage may vary. 
Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/

sub random_list ($) {
    # given a number n, returns a randomly-ordered list
    # of integers from 1 to n. Probably not useful when
    # n becomes too large, but what are you gonna do?
    # NOTE: You must call srand, as needed.
    my @unused = (1..$_[0]);
    my @list;
    push @list, splice @unused, rand(@unused), 1 while @unused;
    @list;
}




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

Date: Mon, 24 Feb 1997 18:46:03 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Keith Warner Colvin <colvin@aloha.net>
Subject: Re: help: syntax error for "}"
Message-Id: <Pine.GSO.3.95q.970224184234.12031O-100000@kelly.teleport.com>

On Mon, 24 Feb 1997, Keith Warner Colvin wrote:

> I am trying to run a .cgi, and I get these error messages, I have tried
> a number of things, what is the advice of you who know more? 

Reading perldiag(1) might be helpful, for starters. It has helpful
suggestions about what to do about every error message Perl generates, and
a few others besides. 

> # Unmatched right bracket, at end of line
>  Line 140
> # syntax error, near "}"
>  Line 140
> # aborted due to compilation errors.

This looks as if perhaps you've gotten mismatched punctuation somewhere. A
good programmers' text editor should be able to help you pair up those
marks. Good luck!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 25 Feb 1997 03:58:58 +0100
From: kompas@galaxy.uci.agh.edu.pl (Piotr Piatkowski)
Subject: Re: help: syntax error for "}"
Message-Id: <5etkhi$1co@galaxy.uci.agh.edu.pl>

Keith Warner Colvin <colvin@aloha.net> wrote:
: Aloha from Hawai'i,

: I am trying to run a .cgi, and I get these error messages, 
: I have tried a number of things, what is the advice of you who know more?

My advice is...

: # Unmatched right bracket, at end of line
:  Line 140

to match right bracket at end of line 140

: # syntax error, near "}"
:  Line 140

and then maybe fix syntax error at line 140, near to "}"

-- 
Piotr Pi1tkowski, Uczelniane Centrum Informatyki, AGH Krakow, POLAND


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

Date: 25 Feb 1997 02:09:42 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: How to spam - legitimately
Message-Id: <5ethl6$gm5@news-central.tiac.net>

In article <33120918.172018446@news.earthlink.net>,
Lee <DeathToSpam@dev.null.com> wrote:
>Unlike many other languages English is extremely dynamic and growing
>at a radical rate.  Presently it is the largest language in size of
>all known languages in the world...over 1 million words.

Wow, but how many of those million does the average speaker use?  Too
diverse a set of regional variations can cause the language to be less
useful as a means of communication, so there is a use for "common ground"
which collections such as the OED and Websters can be used to define.
There may be some people reading this who know what I mean if I were to
use phrases like "Sneck" or "grud on a greenie" or "big byms for
boozlebugs" or "Drokk!" or "Oh shuggles!", but more will be able to guess
fairly accurately at the context they might be used in (but I don't
expect to see them in a dictionary in the near future at least until
2000AD.)

>of users as such.  Unlike British English, French and other languages
>that maintain a language police, the english the rest of the world
>depends upon is truly democratic in the choice of words.

There is no British English language police, and as for the process of the
development of the english language being democratic, well, I suppose my
ballot papers got lost in the post ;-)  Vernacular english is under mob
rule...

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 25 Feb 1997 02:11:59 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: How to spam - legitimately
Message-Id: <5ethpf$grp@news-central.tiac.net>

In article <5est7e$34m$1@csnews.cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:

>:"eletter" would be an
>:abomination.
>
>Hmm.. why is that?  

Surely the Romans set a precedent when they used a great deal of foresight
to put a leading e on pistle in anticipation of these computerised days.

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Mon, 24 Feb 1997 21:13:21 -0800
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: How to spam - legitimately
Message-Id: <Pine.GSO.3.95q.970224210048.24027F-100000@kelly.teleport.com>

On Mon, 24 Feb 1997, Lee wrote:

> Unlike many other languages English is extremely dynamic and growing
> at a radical rate.  Presently it is the largest language in size of
> all known languages in the world...over 1 million words.

Actually, this is untrue. There are some languages which have literally no
limit as to the number of words in them. But English does have a very
large number of words, no doubt about it.

> So is email a word?  Yes, because it has been accepted by a majority
> of users as such.  Unlike British English, French and other languages
> that maintain a language police, the english the rest of the world
> depends upon is truly democratic in the choice of words.

You're right. Once people start usaging a word, it becomes standardified. 
In fact, I'm feeling a bit creatific now-wise, and I'd like to objection
at all the granitypes who don't grok "I fornet a dozen emails about
verbification". Don't you enpensate it? Can't you disconstruct the
affixatives? Wouldn't you rather stragmatize?

I know I would.

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 25 Feb 1997 00:23:51 -0500
From: jlerner@panix.com (Joshua Lerner)
Subject: Re: How to spam - legitimately
Message-Id: <5ett17$579@panix3.panix.com>

In article <8cvi7itdjw.fsf@gadget.cscaper.com>,
Randal Schwartz  <merlyn@stonehenge.com> wrote:

>If I know Tom, that's not what he's complaining about.  In some minds,
>"email" is an aggregate noun, like "people".  So, you can get a huge
>influx of "email", you just can't get 37 new "emails" (ugh, it even
>hurts my ears while I'm typing it).  I suppose that's because "mail",
>at least in the US, is *also* an aggregate noun.  The postman brings
>"the mail" for the day.  I get a "piece of mail".  I don't get 12
>"mails" in one day.  Since email is derived from mail, I can see why I
>have the same weird reaction to "emails".  (Ugh... just reacted
>again. :-)
>
>So, there's no such word as "emails".

Hmmm.  If you think if it as a variation on "mail", "email" does sound
like a collective noun.  However, this word has taken on a life of its
own.  Sometimes a new word does not follow the idiosyncracies of the word
from which it derives.

For example, the past tense of the irregular verb "to fly" is "flew". 
However, the past tense of "to fly out", as in with a fly ball, is "flied
out" -- which is regular.  This is not a cause for concern. (How "email" 
derives from "mail" is not analogous to this example, but the point is
made. "Email", which comes from "mail", need not be considered a
collective noun.)

So, how does one reference a specific number of electronic mail messages? 

Some alternatives:

1. three electronic mail messages -- awkward, wordy
2. three email messages -- see above
3. three messages -- ambiguous
4. three eletters -- not commonly used, so awkward
5. three pieces of electronic mail -- awkward, especially since "piece"
	suggests something material

I have to say, I prefer "three emails" to the sorry candidates above.

Joshua Lerner


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

Date: Mon, 24 Feb 1997 18:23:09 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Manfred Juenke <juenke@itt-sc.de>
Subject: Re: html -> text
Message-Id: <Pine.GSO.3.95q.970224182245.12031L-100000@kelly.teleport.com>

On Mon, 24 Feb 1997, Manfred Juenke wrote:

> LWP could be my friend if HTML::FormatText would support tables!

As soon as you've implemented that, please upload it to CPAN. Thanks!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 25 Feb 1997 02:13:02 GMT
From: Chaimf@cris.com (Chaim Frenkel)
Subject: Re: incremented scalar names, is it possible?
Message-Id: <5ethre$r7r@chronicle.concentric.net>

[cc'ed and posted]

Err, why the hard coded names? The arrays are *JUST* as good.
How can $name01 be better than $iname[1] ????

I'd like to see how the scalar name is more useful.

<chaim>

Tim Allison (tja2f@dayhoff.med.Virginia.EDU) (comp.lang.perl.misc <E64nDG.9p8@murdoch.acc.Virginia.EDU>) wrote:
: in the while loop:
: 	$i = $i++;  
: 	$iname01 = $grep[0];
: 	$iname02 = $grep[1];
: 
: and so on but such that the "i" in iname gets replaced at each cycle of
: the loop???  Or whatever other means would work.
: 
: [Ultimately, 'grep "blahblahblah" *.xyz |sort -lots_of_funky_sort_keys'
: might do the job but as I'll need to deal with the contents later, I'm
: hoping there's a way to do this.]
: 
: 
: I hope that this made sense and will me most appreciative of any help,
: thank you,


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

Date: Tue, 25 Feb 1997 03:40:37 GMT
From: matt@callnet.com (Matthew Ahrens)
Subject: memory leak in HTML::LinkExtor
Message-Id: <331220ad.68035775@news.alt.net>

if I do this:

$p = HTML::LinkExtor->new;

and then do the following many times on different $in's:

    $p->parse($in);
    my @links = $p->links;

then my perl script's memory size grows continually. When I use the
debugger, I see that $p has an increasing number of empty arrays in it as my
program continues to run.

To fix this problem, I just use 
my $p = HTML::LinkExtor->new;
in the subroutine which processes each $in, so that $p gets thrown away and
recreated often.

Although the fix is easy, I don't see why there needs to be this memory
leak. I hope that this post will bring this to the author's attention.

thanks,
--matt


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

Date: 25 Feb 1997 03:52:33 +0100
From: kompas@galaxy.uci.agh.edu.pl (Piotr Piatkowski)
Subject: Re: Multiple values to/from subroutines...
Message-Id: <5etk5h$152@galaxy.uci.agh.edu.pl>

Joe Tseng <jtseng@wauug.erols.com> wrote:
: I know that you can pass out a single value from a subroutine.  But I
: would like to know if it's possible to generate multiple values from one
: subroutine and pass it to another?  I guess you can disperse return
: statements within the 1st subroutine...

Bzzt, wrong guess. man perlsub:

      The Perl model for function call and return values is simple:
      all functions are passed as parameters one single flat list
      of scalars, and all functions likewise return to their caller
      one single flat list of scalars.       ^^^^^^
                      ^^^^
: (I looked in my turquoise Camel book and found no reference to this
: matter.  Somehow I kinda like the pink Camel book better...)

So now you know where to find more :-)

-- 
Piotr Pi1tkowski, Uczelniane Centrum Informatyki, AGH Krakow, POLAND


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

Date: Tue, 25 Feb 1997 03:40:18 GMT
From: arlyn@airmail.net (Arlyn K. Chesley)
Subject: Need PERL script for web site to track activity
Message-Id: <33125f14.7247243@news.airmail.net>

Help!!

I was wondering if anyone had knew where I might be able to locate a
PERL script that would track a websites activity.  I've seen a few of
these mentioned before, but had not had need of one until now.  If
anyone has one, all original author credits will be unmodified.

Thanks, Arlyn

arlyn@airmail.net


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

Date: 24 Feb 1997 21:51:39 -0500
From: Roderick Schertler <roderick@gate.net>
To: Marc The Arc  <maitkin@teleport.com>
Subject: Re: References_>Faster?
Message-Id: <pz3eulmwjf.fsf@eeyore.ibcinc.com>

On 24 Feb 1997 09:02:25 GMT, Marc The Arc  <maitkin@teleport.com> said:
> 
> Since PERL runs via a virtual machine of sorts, I am curious as to 
> whether creating and explicitly using references is a resource-save,
> or does the VM do this implicitly anway?  

It depends on the specifics of the program and data.  The only way to
know is to test it.  This is true in general.  See Benchmark(3pm).

-- 
Roderick Schertler
roderick@gate.net


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

Date: Mon, 24 Feb 1997 18:36:27 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Mike Mitchell <msm@iweb.net>
Subject: Re: Simple pack problem that I can not figure out
Message-Id: <Pine.GSO.3.95q.970224182731.12031M-100000@kelly.teleport.com>

On Mon, 24 Feb 1997, Mike Mitchell wrote:

> I have a 24 bit coded string like:
> 
> "11111111000000000000000000"

Well, it's probably like a 24 bit string, but it has 26 bits, right? :-)

> I am trying to get the decimal equiv for this number (convert from
> binary to unsigned integer). And to go the other way too!
> 
> I have been messing around with pack and I can't seem to get it to work
> right - which is probably because I have yet to fully understand pack.

Try packing it into 32 bits. That is, one of the things you can unpack is
a long integer, which is 32 bits long. So, if you can pack those bits into
32 bits, you're nearly there.

Since you have fewer than 32 bits, add zeroes on the front. 

    $bitstring = "11111111000000000000000000";
    $padding = "0" x (32 - length $bitstring);
    $bitstring = $padding . $bitstring;
    $packed = pack "B32", $bitstring;

Now that you have it packed, just unpack.

    $unpacked = unpack "L", $packed;
    print "$unpacked\n";

Of course, once you understand the steps, you can probably consolidate
several of them. Hope this helps! 

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Mon, 24 Feb 1997 23:25:08 -0500
From: Bill Cowan <billc@tibinc.com>
To: Mike Mitchell <msm@iweb.net>
Subject: Re: Simple pack problem that I can not figure out
Message-Id: <331269A4.228D@tibinc.com>

Mike Mitchell wrote:
> 
> Hi all,
> 
> I have a 24 bit coded string like:
> 
> "11111111000000000000000000"
> 
> I am trying to get the decimal equiv for this number (convert from
> binary to unsigned integer). And to go the other way too!
> 
> I have been messing around with pack and I can't seem to get it to work
> right - which is probably because I have yet to fully understand pack.
> 
> Help please.
> 
> Thanks in advance.
> Mike
 
You may want to check out the "b" and "B" template for pack/unpace. (New
Camel has discussion on 196 and 197.)

-- Bill
-----------------------------------------------------------------------
Bill Cowan <billc@tibinc.com>    Voice:919-490-0034   Fax:919-490-0143
Tiburon, Inc./3333 Durham-Chapel Hill Blvd Suite E-100/Durham, NC 27707


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

Date: 25 Feb 1997 03:45:57 +0100
From: kompas@galaxy.uci.agh.edu.pl (Piotr Piatkowski)
Subject: Re: Trying to understand regex's
Message-Id: <5etjp5$tk@galaxy.uci.agh.edu.pl>

Kevin Posen <posenj@lancet.co.za> wrote:

: I derived this expression to do the task:

: ($first, $excess, $middle, $last) = (/\b(\w+)\b(\s?\b(.*)\b\s+\b(\w+)\b)?/);

: The problem is that it has to introduce a fourth variable (which I could 
: happily do without). Is there a way to rewrite it using only my original 
: three variables?

Perl5 has grouping parenthesis, which doesn't introduce variables, 
they looks like this:  (?:  ) so you could write:

/\b(\w+)\b(?:\s?\b(.*)\b\s+\b(\w+)\b)?/

but have you said "DOS"? I didn't heard about perl5 for DOS and I 
doubt if it exists, so this won't help you much.

-- 
Piotr Pi1tkowski, Uczelniane Centrum Informatyki, AGH Krakow, POLAND


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

Date: Mon, 24 Feb 1997 21:00:06 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Dave Peters <dave@nuance.com>
Subject: Re: uc without explicit argument inside map. Bug?
Message-Id: <Pine.GSO.3.95q.970224205755.24027E-100000@kelly.teleport.com>

On 24 Feb 1997, Dave Peters wrote:

> Running perl5.003. 

> I'd have hoped that uc would behave like most of the other functions,
> and employ $_ as its default argument! Is this fixed in the current
> version?

No, but it'll be fixed in the next version. (5.004, available in beta
RSN.) Nobody caught it until the Camel book documented it, and by then it
was too late, so we had to fix Perl to match the book. :-) 

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Tue, 25 Feb 1997 14:47:30 +1000
From: Ron Savage <rpsavage@ozemail.com.au>
Subject: Re: Variable interpolation with s/// operator
Message-Id: <33126EE2.156D@ozemail.com.au>

Tom Burton-West wrote:
[snip]
> #Why does it work for $EM_In but not for $EM_Out?
>         In_String=~s/$EM_In/$EM_Out/;[snip]

This was a problem with Perl 4. Perl 5 does not interpolate either.


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

Date: Mon, 24 Feb 1997 23:55:43 -0500
From: Chris Plachta <stats9@mail.idt.net>
Subject: Why do I keep getting segmentation faults?
Message-Id: <331270CF.50339F85@mail.idt.net>

I've been getting wierd segmentation faults when running a large
script that I've been writing.  This is the second time it has 
happened.  I think it may have to do with memory usage.  The script
uses a bunch of really large data structures and I'm worried that
I might be pushing the limits of my machine.  Is there any way to
tell how much memory my program is using?  Any advice?  Thanks.

Chris


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

Date: 24 Feb 1997 21:35:01 GMT
From: "JR Tietsort" <jrtietsort@micron.com>
Subject: Win32::NetAdmin
Message-Id: <01bc229a$c3c2c200$9b6ac989@jrtietsort>

Does anyone have any working code using the NetAdmin module under NT?  I
have tried and tried to get something returned, but have had no success. 

Any help is appreciated....

Thanks,
JR Tietsort
jrtietsort@micron.com


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

Date: 24 Feb 1997 21:51:35 -0500
From: Roderick Schertler <roderick@gate.net>
To: king@cogsci.ucsd.edu (Jonathan King)
Subject: Re: Yet another desirable pack format: (was re: Strange pack/unpack...)
Message-Id: <pz67zhmwk3.fsf@eeyore.ibcinc.com>

On 24 Feb 1997 09:02:56 GMT, king@cogsci.ucsd.edu (Jonathan King) said:
> 
> Any chance of seeing signed and ordered shorts after 5.004?

Good idea, I've wanted those myself.

> Any better chance if I provided a nifty patch? :-)

It sure ain't gonna hurt.  Include longs, too.  I don't know what
letters to use (that choice is probably the hardest part of the whole
deal).

-- 
Roderick Schertler
roderick@gate.net


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

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

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

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