[10880] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4481 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 22 17:57:20 1998

Date: Tue, 22 Dec 98 14: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           Tue, 22 Dec 1998     Volume: 8 Number: 4481

Today's topics:
        gmtime on SGI different mbrennan@observera.com
    Re: gmtime on SGI different (Martien Verbruggen)
    Re: How to read an Audio CD's TOC under LINUX <jason.holland@dial.pipex.com>
    Re: Installing Perl on Windows 95 or Windows 98 (Larry Rosler)
    Re: Nested sorting (Bill Moseley)
    Re: Nested sorting <uri@ibnets.com>
    Re: newbie: cannot grab a webpage with frame (Martien Verbruggen)
    Re: NT login script to query group membership.... (Martien Verbruggen)
    Re: numbers in base 36 (Abigail)
    Re: numbers in base 36 <jhi@alpha.hut.fi>
    Re: Perl 5.005_002 and berkeley db problems bostic@bostic.com
    Re: Perl and As400 <jhi@alpha.hut.fi>
    Re: Perl/Java cgi script with pws <pdchapin@unix.amherst.edu>
        problem with $/ <alex@kawo2.rwth-aachen.de>
    Re: Q: is srand(time()); good enough? (Randal L. Schwartz)
        recuper le Mime type d'un fichier - Content-type of fil <Edouard.Ouin@tinet.ie>
    Re: regular expressions <jdf@pobox.com>
    Re: rename a large file problem (Abigail)
    Re: Retrospective on comp.lang.perl.moderated? (Martien Verbruggen)
    Re: Searching for wildcard characters (Larry Rosler)
    Re: sizeof() function? (Andrew M. Langmead)
    Re: sorting <Allan@due.net>
    Re: sorting (Tad McClellan)
    Re: Turning Variables into CAPS? (Larry Rosler)
        What's wrong with this code? <will@localads.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 22 Dec 1998 20:47:33 GMT
From: mbrennan@observera.com
Subject: gmtime on SGI different
Message-Id: <75p0h3$u91$1@nnrp1.dejanews.com>

I have a script that uses (POSIX) gmtime to format a date. The script was
originally written on an SGI (6.3) using perl 5.002. Recently the script was
run on an SGI (6.5) using perl 5.004_04, and the formatted date was wrong.
The date returned by gmtime contained the letters "EST" on the 6.5 system,
but did not contain those letters from the 6.3 system - as a result the
format was wrong and the output from the script didn't work. It was easy to
fix, but now I have 2 versions of the script.

I don't know if this is a result of the OS upgrade or Perl upgrade. My guess
is it's due to the OS upgrade, but I want to get a second opinion so I know
what my code should check for (when I add an 'if statement' around the date
format code).

- Michelle Brennan
mbrennan@observera.com

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


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

Date: Tue, 22 Dec 1998 21:41:12 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: gmtime on SGI different
Message-Id: <YlUf2.49$jf.1310@nsw.nnrp.telstra.net>

In article <75p0h3$u91$1@nnrp1.dejanews.com>,
	mbrennan@observera.com writes:
> I have a script that uses (POSIX) gmtime to format a date. The script was

If both systems are POSIX, you could use the strftime() function from
the POSIX module to ensure that the format is the same. The
implementation of whatever gmtime and localtime return in scalar
context, very likely depends ont he system's implementation of the
ctime(3) or asctime(3) functions (on a POSIX system it should call
(ctime_r() and asctime_r(), but I don't know if it does, and I'm too
lazy to look at the perl code :). Besides that, your system may still
implement them differently)

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | The world is complex; sendmail.cf
Commercial Dynamics Pty. Ltd.       | reflects this.
NSW, Australia                      | 


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

Date: Tue, 22 Dec 1998 19:34:09 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
Subject: Re: How to read an Audio CD's TOC under LINUX
Message-Id: <367FF431.B532BDB6@dial.pipex.com>

Sideliner wrote:
> 
> Can anybody help me with this?
> 
> I would really like to read the Table Of Contents from an Audio CD in
> PERL, under LINUX.
> 
> I need to be able to read the tracks list including sector offsets etc
> from both IDE and SCSI CD-ROMS.
> 
> I have searched CPAN but can't find anything that comes close - any
> hints or suggestions would be most welcome.


Hello Sideliner, is that your __real__ name?

Sounds like you need to find a device driver that can be used by Perl.
Alterntivel, you could try the hard route and read the device directly.
Doing a 'cat /dev/hdc' on my system spews out the raw disk data.
Probably won't work for an Audio disk though...

Bye

-- 
sub jasonHolland {
    my %hash = ( website =>
'http://dspace.dial.pipex.com/jason.holland/',
                 email   => 'jason.holland@dial.pipex.com' );
}


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

Date: Tue, 22 Dec 1998 10:48:45 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Installing Perl on Windows 95 or Windows 98
Message-Id: <MPG.10e989642a038e419898e5@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <75n7s6$p8@sjx-ixn10.ix.netcom.com> on Mon, 21 Dec 1998 
23:42:55 -0500, fguarner <fguarner@ix.netcom.com> says...
> I am fascinated with learning perl, but I don't have a clue how get an
> compatible version. I've read some discouraging stuff about installing perl
> on Windows 95. Is there a version out there somewhere thats semi easy to
> install and works.

http://www.activestate.com/ActivePerl/ has a version that is *very* easy 
to install and works.

> Please email me at fguarner@ix.netcom.com

No munge, no problem.

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


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

Date: 22 Dec 1998 21:00:09 GMT
From: moseley@best.com (Bill Moseley)
Subject: Re: Nested sorting
Message-Id: <36800859$0$208@nntp1.ba.best.com>

In article <x7vhj5jli5.fsf@sysarch.com>, uri@sysarch.com says...
>hey randal, i know what i was doing. i was just trying to demonstrate a
>preprocessing sort idea without the extra confusion of explaining the ST
>and maps. the original poster was having enough problems understanding
>why you don't do processing work in the compare sub. this was just a way
>to show hoe to break up the up and down keys into something that would
>make for a faster sort.

Actually, I did understand the importance of pre-processing -- I just didn't
post what I was doing in pre-processing.

The sticky point for me was that I receive a List of Lists, an array of 
field names to do my nested sort, and an array of flags that say which 
field names are to be reversed sorted and that's it.

I don't know if a field is just strings, just numbers, mixed,
floating point, dates, or whatever.  So I'm making kind of a general purpose
nested sort routine.

I wanted to build a single sort key but I didn't understand how to inverse
a sub-string within my single sort key to get that key to do a reverse sort.
Larry helped here.

Building a single key to sort on requires figuring out how to "stringify"
it consistently, which means going through the data first to see my bounds.
I have to figure out the individual key's field width and how to represent 
it in a way that will do a string sort. 

Most of that I know now, thanks to all your help.

I'm still not sure how to detect if I have floats, or not.
Is checking that int($n) == $n for each value enough?


The ST examples don't seem that confusing, even to me.  Just pre-processing
and data-extraction around a sort.  (Although it still seems silly to copy
all the data in the second map instead of just using a reference to the data
--- even though when I ran timings it was faster to copy the data!  That
might be different if each data thing was large.)  I'd have to understand
how the ST code gets compiled to understand why the ST is that much faster 
than doing it in individual steps, I guess.

And back to nested sorts:

I wonder if it would make more sense to not "stringify" but rather pack a
binary structure by double words or whatever the largest binary compare
can be on the machine.  It just kinda bugs me to turn numbers into strings
just to compare them. ;)  But I guess it isn't much slower to do a
byte-by-byte compare than an arbitrary length double word compare.


--------------
Bill Moseley
moseley@best.com



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

Date: 22 Dec 1998 16:24:36 -0500
From: Uri Guttman <uri@ibnets.com>
Subject: Re: Nested sorting
Message-Id: <39g1a750q3.fsf@ibnets.com>

>>>>> "BM" == Bill Moseley <moseley@best.com> writes:

  BM> I don't know if a field is just strings, just numbers, mixed,
  BM> floating point, dates, or whatever.  So I'm making kind of a general purpose
  BM> nested sort routine.

you can still do that by building a hash or LOL with the keys put into
the slots according to their type and ordering. you still have not
defined your inputs to us. you can't do what you want as i have said
before since comparing to things which are different in ordering or type
makes no sense. multilevel sorts must give priorities to each key type
so they are compared first and if they match, then the next level key is
compared, etc.

so if you can define the keye level order, then you can define the
multilevel compare data structure, then you can convert to and from that
structure. that is as general purpose as you can get. anything more will
probably be a pig in the compare code. you might be able to generate a
compare sub ont the fly with eval according to the way the structure is
created. that would need a preprocess and postprocess sub written on the
fly too. that would be the ultimate general purpose sort.

  BM> The ST examples don't seem that confusing, even to me.  Just pre-processing
  BM> and data-extraction around a sort.  (Although it still seems silly to copy

that is the heart of the ST, so you don't understand ST well yet. what
ST does is create a temp array of arrays, each with the original sort
data and broken out keys as elements. the sort code then indexes into
the array to get at the keys. the postprocess code just indexes into the
array to get the original data back again.

  BM> all the data in the second map instead of just using a reference to the data
  BM> --- even though when I ran timings it was faster to copy the data!  That
  BM> might be different if each data thing was large.)  I'd have to understand
  BM> how the ST code gets compiled to understand why the ST is that much faster 
  BM> than doing it in individual steps, I guess.

i would thing the reference copy would be faster but we can't tell unles
we see your code and benchmark for that.

  BM> And back to nested sorts:

  BM> I wonder if it would make more sense to not "stringify" but rather pack a
  BM> binary structure by double words or whatever the largest binary compare
  BM> can be on the machine.  It just kinda bugs me to turn numbers into strings
  BM> just to compare them. ;)  But I guess it isn't much slower to do a
  BM> byte-by-byte compare than an arbitrary length double word compare.

stringify may be a poor name. it is not necessarily converting to a
printable ascii string but rather a string of bytes which are sortable
by the builtin cort cmp code. pack is best used for that to give a
binary string rather than sprintf which would give an ascii string. both
would work and each probably has its wins and losses.

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: Tue, 22 Dec 1998 21:31:20 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: newbie: cannot grab a webpage with frame
Message-Id: <IcUf2.47$jf.1310@nsw.nnrp.telstra.net>

In article <199812220623.GAA18965@keisgaig.dcs.ed.ac.uk>,
	Budi Ling <bl@dcs.ed.ac.uk> writes:

> I'm using webget for grabbing a web page, but when
> the webpage contains a frame, I get the following
> message:
> 
> 
> <FRAMESET cols="100,1*" frameborder=0 framespacing=0 border=0>
> <NOFRAMES><BODY>

> Is there any way to solve this? Thanks beforehand,

There really is no problem. You asked the server for that page, you
got that page. If you want the pages the frame tags refer to:

Parse the frame tags. Get the URLs for whatever they refer to.

You could try doing this with the HTML::Parser and/or
HTML::TreeBuilder modules.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 
Commercial Dynamics Pty. Ltd.       | Can't say that it is, 'cause it ain't.
NSW, Australia                      | 


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

Date: Tue, 22 Dec 1998 21:37:45 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: NT login script to query group membership....
Message-Id: <JiUf2.48$jf.1310@nsw.nnrp.telstra.net>

In article <19981222130601.25117.00000156@ng127.aol.com>,
	mjd440@aol.com (Mjd440) writes:

> I need to change  my login script so drives are mapped  according to
> what groups a user belongs to.  The NT resource kit has some
> utilities that will take care of this for me, but they don't work
> for Win95 users.  Is there way I can get this info into my login
> script?

And your perl question is?

You should probably ask this on a Microsoft specific group. I don't
think Win95 has a concept of groups, so your question may be
meaningless, but again, ask in a MS specific group to find out.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd.       | you come to the end; then stop.
NSW, Australia                      | 


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

Date: 22 Dec 1998 19:00:12 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: numbers in base 36
Message-Id: <75oq7s$7ne$1@client3.news.psi.net>

droby@copyright.com (droby@copyright.com) wrote on MCMXXXIX September
MCMXCIII in <URL:news:75od2e$d29$1@nnrp1.dejanews.com>:
++ In article <75luud$ces$1@nnrp1.dejanews.com>,
++   ptimmins@netserv.unmc.edu wrote:
++ >
++ > I can't get past 60*789**105 on any of the systems I have access to,
++ > let alone 569*789**328, so I'll ignore that dig :) ... or is there some
++ > way to derive it, rather than actual numerical computation?
++ 
++ I suspect it requires actual numerical computation with BigInts.
++ 
++ Here's mine, and it works on a Pentium 166 running Linux 2.0.36.

[ 55 line solution deleted ]

Here's a one liner, with no need for Perl:

$ echo "obase = 789; 123 ^ 456" | bc



Abigail


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

Date: 22 Dec 1998 22:25:19 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: numbers in base 36
Message-Id: <oeen24fhqkw.fsf@alpha.hut.fi>


abigail@fnx.com (Abigail) writes:

> droby@copyright.com (droby@copyright.com) wrote on MCMXXXIX September
> MCMXCIII in <URL:news:75od2e$d29$1@nnrp1.dejanews.com>:
> ++ In article <75luud$ces$1@nnrp1.dejanews.com>,
> ++   ptimmins@netserv.unmc.edu wrote:
> ++ >
> ++ > I can't get past 60*789**105 on any of the systems I have access to,
> ++ > let alone 569*789**328, so I'll ignore that dig :) ... or is there some
> ++ > way to derive it, rather than actual numerical computation?
> ++ 
> ++ I suspect it requires actual numerical computation with BigInts.
> ++ 
> ++ Here's mine, and it works on a Pentium 166 running Linux 2.0.36.
> 
> [ 55 line solution deleted ]
> 
> Here's a one liner, with no need for Perl:
> 
> $ echo "obase = 789; 123 ^ 456" | bc

Cheating!  My original question wanted the answer in Java.  Somebody
said "Java" and "in any base"...

> Abigail

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: Tue, 22 Dec 1998 21:41:30 GMT
From: bostic@bostic.com
Subject: Re: Perl 5.005_002 and berkeley db problems
Message-Id: <75p3ma$104$1@nnrp1.dejanews.com>

In article <367FE5A5.FC256712@iscusa.com>,
  Colin Earl <colin@iscusa.com> wrote:
> Hi Pete,
>
> You might consider switching to mySQL or similar even if the
> tests all work. We found some severe bugs in Berkeley DB that
> were not exposed by any of the tests.
>
> Raphael

I'm sorry to hear this!  Did you ever report these bugs to anyone
(either the author of the Perl modules or Sleepycat Software)?

Regardless, can you be more specific?  What problems did you find?

--keith

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


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

Date: 22 Dec 1998 22:26:40 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Perl and As400
Message-Id: <oeeiuf3hqin.fsf@alpha.hut.fi>


How about contacting the person mentioned in the README.TXT?

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: Tue, 22 Dec 1998 14:25:53 -0500
From: "Paul Chapin" <pdchapin@unix.amherst.edu>
Subject: Re: Perl/Java cgi script with pws
Message-Id: <367ff244.0@amhnt2.amherst.edu>

>I have never been able to get spawning an external process from a CGI
>program to work with PWS. It likely is simply just not going to be
>possible. PWS will run small, normal CGI programs but not complex ones
>that depend on calling external programs.


I was terribly afraid somebody would say that.  Can anybody confirm or deny
this?  Does IIS running on NT have the same problem?

-----
Paul Chapin
UNIX Manager
Amherst College
413 542-2144
http://www.amherst.edu/~pdchapin




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

Date: Tue, 22 Dec 1998 22:39:44 +0100
From: Alex Farber <alex@kawo2.rwth-aachen.de>
Subject: problem with $/
Message-Id: <368011A0.4DB06830@kawo2.rwth-aachen.de>

Dear perl hackers,

I have a file, which consists of many blocks, 
separated by "-----------------\n". And there's 
a multi-lined comment at the end of some blocks:

-----------------
blah blah blah
blah2 blah2
Comment:  yadda yadda
        yadda yadda
-----------------

Now how do I extract these comments (yadda)? I try:


$INPUT_RECORD_SEPARATOR = "-----------------\n"
 ...
while (<READ>)
{
    if (m'\nComment:\s+(.+)${INPUT_RECORD_SEPARATOR}'is) 
    {
        $comment = $1;
    }
}

But it does not work ($comment is always undef) ??

/Alex

--
http://www.simplex.ru/pref.html


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

Date: Tue, 22 Dec 1998 18:53:59 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Q: is srand(time()); good enough?
Message-Id: <m1vhj42eh6.fsf@halfdome.holdit.com>

>>>>> "Greg" == Greg Ward <gward@thrak.cnri.reston.va.us> writes:

Greg> I have a dim and distant recollection of Randall Schwartz posting advice
Greg> along the lines of "don't seed with just 'time' -- use 'time ^^ $$'",
Greg> ie. mix another predictably-varying value (the process id) in with an
Greg> XOR.  Of course, both the time and the process id vary in an extremely
Greg> predictable way, and only in the lower couple of bits.  For serious
Greg> random number applications (eg. Monte Carlo simulation), I don't think
Greg> they're enough.  YMMV...

Yes, that was before Math::TrulyRandom was available on the CPAN as well.
For now, I'd recommend what the manpage says in 5.004 et. seq.

print "Just another random Perl hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Tue, 22 Dec 1998 19:47:56 +0000
From: Edouard Ouin <Edouard.Ouin@tinet.ie>
Subject: recuper le Mime type d'un fichier - Content-type of file
Message-Id: <367FF76C.BEA93EC0@tinet.ie>

Hi,

Comment recuperer le Content-type d'un fichier stocke sur un disque dur,
c'est a dire recupere son mime type, dont la liste se trouve dans le
fichier mime.types pour ce qui est de la config d'un serveur web Apache.

Merci pour votre temps.

--
---------------------------------------------------------
Edouard Ouin
Telecom Internet                    Tel: (353) 1 701 0182
Unit B, East Point Business Park    Fax: (353) 1 701 1086
Fairview                            http://www.tinet.ie
Dublin 3                            Edouard.Ouin@tinet.ie
Ireland                             Mobile : 087 289 0934




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

Date: 22 Dec 1998 20:16:00 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: "Derek Chaloner" <Derek.Chaloner@securepay.co.uk>
Subject: Re: regular expressions
Message-Id: <m3u2yo56of.fsf@joshua.panix.com>

"Derek Chaloner" <Derek.Chaloner@securepay.co.uk> writes:

> Although I had tried the /e modifier on the substitute, I had not realised
> that it could  be used more than once, thus enabling double interpolation as
> was required.

It's documented that way, as in perlop:

           # /e's can even nest;  this will expand
           # any embedded scalar variable (including lexicals) in $_
           s/(\$\w+)/$1/eeg;

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: 22 Dec 1998 19:38:03 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: rename a large file problem
Message-Id: <75oser$867$1@client3.news.psi.net>

Guillaume Dupuis (guillaume@sandtechnology.com) wrote on MCMXXXVIII
September MCMXCIII in <URL:news:367EAD86.A74B22F5@sandtechnology.com>:
++ > unlink("oldfile.bak")
++ > || die("Can't delete the oldfile.bak file.\n");
++ 
++ First, be sure that your file is really erased, because I've tried to
++ rename a file with a name that already existed, and unlike it is written
++ in the books, it did not over-write it (I use perl under NT).
++ 
++ > rename("oldfile", "oldfile.bak") || die("Can't rename oldfile.\n");
++ 
++ What I did is:
++ ###########
++ 
++ $new_file = "data\.gz";
++ $bak_file = "data\.gz\.bak";
++ rename($new_file,$bak_file);
++ 
++ ############
++ 
++ Dont forget the "\" or else it will take the "." for a literal
++ character...

Well.... \. does mean a literal . In both strings and regexes.
And why wouldn't you want a .? Which you can also write as .

There's no difference between "data\.gz" and "data.gz" after the
tokenizer went through.

++ I also tried to use rename with the literal file names:
++ 
++ rename(data\.gz, data\.gz\.bak);

That's a horrible syntax error.

++ 
++ ...
++ but it does't work, I get compilation errors.
++ And if I do it without the "\", I don't get any errors messages, nor
++ results...

That's because you aren't using 'use strict' nor '-w'. If you just have
data.gz, Perl will see two strings, 'data' and 'gz', and an operator, '.'.
That's the concatenation operator.

So,
        rename (data.gz, data.gz.bak)
is really
        rename ("datagz", "datagzbak")

which fails because there isn't a 'datagz' file.


You should always, always, always use both 'use strict' and '-w'.
That would have saved you a lot of problems. 'use strict' would have
forbidden you to use data.gz without quotes, while '-w' would have
warned you about it.




Abigail


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

Date: Tue, 22 Dec 1998 21:13:32 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Retrospective on comp.lang.perl.moderated?
Message-Id: <0YTf2.43$jf.1310@nsw.nnrp.telstra.net>

In article <368078a3.2905811@news.ozemail.com.au>,
	daccles@bad.spam.no.spam.pcug.org.au (Excession) writes:
> This never seemed to make it out, so I'm sending it again.

You shouldn't have bothered.

> I was amused, most amused, to see that comp.lang.perl.misc -expanded- in

Gosh... You're a nice person, aren't you? If you make claims like
that, I'd like you to provide the numbers proving it. I have not seen
much change in the way clp.misc works since clp.mod came into
existence.

> Yeah, right.  That would erode their veritable mountain of pride in
> a flash, if these purists and fascists of the Perl community would
> actually practice the 'Be nice' approach to Perl queries.

Being nice, in the way that you are being nice in your criticisms?
Hmm.

Pot.. Kettle..

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Inside every anarchy lurks an old boy
Commercial Dynamics Pty. Ltd.       | network - Mitchell Kapor
NSW, Australia                      | 


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

Date: Tue, 22 Dec 1998 10:57:27 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Searching for wildcard characters
Message-Id: <MPG.10e98b74dd7c17fe9898e6@nntp.hpl.hp.com>

In article <367FC2BF.BE3CD0B5@bottom.of.sig> on Tue, 22 Dec 1998 
16:03:11 +0000, Ryan <see@bottom.of.sig> says...
> simple question..

Very!

> how can i search for the * character ?

/\*/

Similarly for all 'magic' characters.  You can also use /\Q*/.

See `perldic perlre` and `perldoc -f quotemeta`.

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


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

Date: Tue, 22 Dec 1998 18:52:49 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: sizeof() function?
Message-Id: <F4Dr41.DzK@world.std.com>

Sean Hussey <sean@youknowwhattoremove.weblabs.com> writes:

>I must be going crazy here.  I could have sworn there was a sizeof()
>function (or something like it) in Perl.  Am I just confusing it with C
>and JavaScript?  Is there something in Perl that will do something like
>sizeof() in these other languages?

It depends on what you think a sizeof() in Perl would do. There is a
length() function, which is like C's strlen(). For arrays of
characters that are implicitly dimensioned by a constant initializer
(like char my_string[] = "This is the string.") the sizeof operator
may give the impression of looking somewhat strlen(). (Of course, if
you change the delcaration to a pointer to a constant string (like
char* my_string = "This is the string.") it stops looking at all like
the strlen() function.)

If you are looking for something other than the number of bytes in a
scalar, you're going to have to be a little more explicit on what you
are expecting.

-- 
Andrew Langmead


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

Date: Tue, 22 Dec 1998 14:00:00 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: sorting
Message-Id: <75optq$c2f$1@camel18.mindspring.com>

tabo wrote in message <367FE0F0.FA9AB3BB@rica.net>...
>this is a little blurb that i wrote to try out the sort()
>
>open (WORDLIST, "+< x33b.txt") || die "cant open $filename: $!";
>while (defined ( $list = <WORDLIST>)) {
>chomp ($list);
>@lists = <WORDLIST>
>}
>close(WORDLIST);


Well that is interesting.  You read in one line of WORDLIST and chomp it.
Then you read the rest of the file into @lists leaving all the newlines,
except I bet the very last line in your file does not have a newline does
it.  Guess which file name is the last one in your file..... yup the first
one on that line with two.  You realize that the while only loops once
because all of WORDLIST goes into @list the first time and there is nothing
more to read.  Plus, the first file name is missing from @lists, it was in
that first assignment to $list.

>
>$writefile = "temp2.txt";
>open (WRITE, "> $writefile") || die "cant open $writefile:$!";
>print "$lists[0]\n";
>print "$lists[1]\n";
>
>@articles = sort {uc($a) cmp uc($b)} @lists;
>
>$items = $#articles;
>print "$items\n";
>for ($i =0;$i<$items;$i=$i+1) {
>print WRITE"$articles[$i]";
>}

I don't think that is what you want.  First, remember you first file name
was missing so you array is one file short.  Then you use < rather than <=
so you drop the last element of  @articles too.  Oops.

So maybe
foreach (@articles){
    print WRITE;
}
might have been a lot cleaner and clearer way to write that.  Or

foreach $filename (@articles){
    print WRITE $filename;
}

Of course you still will have one line with two file names and you are are
still missing that first filename.  You need to chomp @list or @articles and
then print using \n or make sure there is a newline for the last line in the
file.

>close (WRITE);
>
>it works fine for the most part.  this is the output files contents


Umm, I not sure fine is a great description here.  You are missing two file
names from your original list <g>.

HTH

AmD




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

Date: Tue, 22 Dec 1998 13:38:56 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: sorting
Message-Id: <ggso57.po5.ln@magna.metronet.com>

tabo (cswfrank@rica.net) wrote:
: this is a little blurb that i wrote to try out the sort()

: open (WORDLIST, "+< x33b.txt") || die "cant open $filename: $!";


   Why open for read/write if you are only going to read?


: while (defined ( $list = <WORDLIST>)) {
: chomp ($list);


   Why chomp $list if you are never going to do anything with $list?


: @lists = <WORDLIST>

   You know that your while() only executes the body one time,
   because this slurps up all of the rest of the lines on the
   WORDLIST filehandle?

   You are missing a semicolon there.

   Don't try and type in code. Use cut/paste. Else you will get
   a bunch of comments about your typos instead of about your
   real code (because you have not given us your real code...)



: can anyone explain why there are two entries on one line?


  No.

  Because we don't have the same code that you have.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 22 Dec 1998 12:23:54 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Turning Variables into CAPS?
Message-Id: <MPG.10e99fb21bfee1b99898e7@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <75nkn8$hdl$1@sibyl.sunrise.ch> on Tue, 22 Dec 1998 09:18:45 
+0100, Kai <kait@vacheron.ch> says...
> Several other possibilities besides what others have contributed :
> 
> First you can use escape sequences in strings such as :
> 
> $c = "\U$c";
> 
> - or - use string transformation such as :
> 
> $c =~ tr/[a-z]/[A-Z]/;

Why do you want to transliterate '[' to '[' and ']' to ']'?  :-)

> - or - use the uc function such as :
> 
> $c = uc($c);
> 
> The catch is that all these methodes do not handle accentuated caracters
> properly. You could easily use tr/// and add specific accentuated characters
> and burry it in a function.

'\U' and 'uc()' respect the current locale, if any.  The following is 
quoted from `perldoc perllocale`:

The LC_CTYPE locale also provides the map used in transliterating 
characters between lower and uppercase. This affects the case-mapping
functions--lc(), lcfirst, uc(), and ucfirst(); case-mapping 
interpolation with \l, \L, \u, or \U in double-quoted strings and s/// 
substitutions; and case-independent regular expression pattern matching 
using the i modifier. 

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


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

Date: Tue, 22 Dec 1998 20:57:59 -0000
From: "WL" <will@localads.net>
Subject: What's wrong with this code?
Message-Id: <75p1f8$vd5$2@news8.svr.pol.co.uk>

Hi,

The following code worked fine, when I ran it under Telnet using "perl
stf.cgi":
_______________________________________________
require 'configs.cfg'; # System configuration file

  require 'subs.pl';      # System required sub-routines

 $SendEmail = "yes";
 $EmailAddress = "will\@localads.net";
 $Locie = "Localads.net";

    if ($SendEmail eq "yes") {
 # Open The Mail program, send notice of new AD submittal to Webmaster
 open(MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";
 print MAIL "To: $EmailAddress\n";
 print MAIL "From: $Locie\n";
 print MAIL "Subject: Test Message\n\n";

 }
 close (MAIL);
_______________________________________________
Then, I added this bit of code afer the print MAIL Subject line:

print MAIL "$in{'City'}";

This takes the text City variable from the web page - but it didn't, or
rather it returned a server error :((  I use the post statement, - could
this have been the problem?

I'd be very grateful for any help, to will@localads.net

Many thanks indeed,

Will




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

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


Administrivia:

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

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

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

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

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

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


------------------------------
End of Perl-Users Digest V8 Issue 4481
**************************************

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