[12472] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6072 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 21 02:07:18 1999

Date: Sun, 20 Jun 99 23:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 20 Jun 1999     Volume: 8 Number: 6072

Today's topics:
    Re: A buggy intersection-method (Ronald J Kimball)
    Re: Afraid to ask about Y2K! <dgris@moiraine.dimensional.com>
    Re: bug? "Odd number of elements..." (Abigail)
    Re: can you split a word into letters? (Andrew Johnson)
    Re: cgi query error (Ronald J Kimball)
        CGI.pm: submit + image? (Peter Bismuti)
    Re: Cure for document deficiency (Abigail)
    Re: dbmopen as opposed to tie -- for a database (William Herrera)
    Re: deleting part of a string (Abigail)
    Re: File modification time question... (William Herrera)
    Re: function to read a line & return it <rick.delaney@home.com>
    Re: function to read a line & return it <mhc@Eng.Sun.COM>
    Re: Garbage collection question (Abigail)
        how to do this in a perl program <jbell@263.net>
        How to output the current perl script in memory <helpdesk1@midcoast.com.au>
    Re: How to remove space (Abigail)
    Re: how to remove spaces in a line (Abigail)
    Re: How to use svrmgrl commands in Perl CGI (Abigail)
    Re: Interpreting MS-ASCII - anyone have a filter? <monty@primenet.com>
    Re: newbie question... (Ronald J Kimball)
    Re: Parsing bug in Perl? (Ronald J Kimball)
    Re: Parsing bug in Perl? (Ronald J Kimball)
    Re: Perl scripts slows down servers? (Danny Aldham)
    Re: printing multiple lines <rick.delaney@home.com>
    Re: Questions <mhc@Eng.Sun.COM>
    Re: Questions (Abigail)
    Re: Server Running Perl - Resources? (Ronald J Kimball)
    Re: Very very short tutorial about modules <ask@netcetera.dk>
    Re: What is functional difference between .pm and .pl? (Abigail)
    Re: What is functional difference between .pm and .pl? (Ronald J Kimball)
        XS question: problem with adv. perl example kellan1@my-deja.com
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sun, 20 Jun 1999 23:04:38 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: A buggy intersection-method
Message-Id: <1dtpvth.12vqbdzjqzudqN@p7.tc8.metro.ma.tiac.com>

Darrin Edwards <d-edwards@uchicago.edu> wrote:

> But even if that's so, you can modify Uri's suggestion very easily:
> > > @lol = map [getEntries( lc $_ ) ] @ARGV ;
> 
>   @lol = map {defined($_) ? [getEntries(lc $_)] : undef} @ARGV;
> 

But that's overkill, because how would @ARGV get undefined values
anyway?  It's very hard to pass undef in from the command line...

The problem was that the original code used elements 0 .. 14 of @ARGV,
without caring how many elements @ARGV actually contained!  Since Uri's
code _loops_ over the _existing_ elements of @ARGV, the defined() test
is superfluous.

-- 
#!/usr/bin/sh -- chipmunk (aka Ronald J Kimball)
      perl -s -e'print sort grep { /\s/ } keys %main::
            ' -- -is -' Just' -' another ' -'Perl ' -'hacker 
' http://www.tiac.net/users/chipmunk/ [rjk@linguist.dartmouth.edu]


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

Date: 20 Jun 1999 23:34:00 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Afraid to ask about Y2K!
Message-Id: <m3so7mung7.fsf@moiraine.dimensional.com>

abigail@delanet.com (Abigail) writes:

> Bart Lateur (bart.lateur@skynet.be) wrote on MMCXIX September MCMXCIII in
> <URL:news:3772a9f5.2388358@news.skynet.be>:
> '' 
> '' I also think that for such short scripts, use of a (largish) module can
> '' double the total execution time of the scriptlet.

> How large do you think this wrapper around localtime() should be?

use LWP::localtime;   # :-)

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: 20 Jun 1999 17:44:09 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: bug? "Odd number of elements..."
Message-Id: <slrn7mqrli.k1b.abigail@alexandra.delanet.com>

Bill Huston (bhuston@eden.com) wrote on MMCXIX September MCMXCIII in
<URL:news:72bb3.265$o7.57164@typhoon-sf.snfc21.pbi.net>:
{} 
{} I just found what looks like a bug. (5.004_04 built for i486-linux)
{} The following code has a syntax error: it uses "sub{args}" intending
{} "sub(args)".  Yet it passes compilation, but produces a strange warning:
{} "Odd number of elements in hash list at odd2 line 6":
{}   #!/usr/bin/perl -w
{}   
{}   sub sub_a{};
{}   sub sub_b  {
{}     my %args = ( @_ ) ;
{}     if (defined $args{FOO}) {            # warning on this line! 
{}         $args{BOZO} = sub_a{$args{FOO}}  # oops, used a{} not a()!  
{}     } 

It's simple. You call 'sub_a' with one argument, a reference to a hash.
That hash only contains one element, triggering the warning.

{} Questions:
{} 
{} 1:    What is the meaning of bareword{stuff}? Shouldn't it
{}       produce a syntax error? (unless it is meant to
{}       dereference a hash reference returned by the
{}       sub named "bareword" ??)

It's not a "bareword". Said "bareword" is a subroutine, as prototyped.
{stuff} is the argument to the subroutine (remember, in Perl there's
often no need to put parens around the argument lists of subroutines).

{} 2:    Why is the "Odd number..." warning produced where it is?

In this case {...} is a reference to a hash. A hash with one argument.
One is odd.

The only bugs here are in your code and your understanding of the code.


Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
                       -> define ("foldoc", "perl")) [0] -> print'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 21 Jun 1999 03:40:29 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: can you split a word into letters?
Message-Id: <Nuib3.4170$36.80841@news2.rdc1.on.home.com>

In article <19990620225849.01980.00001937@ng-cc1.aol.com>,
 Weborium <weborium@aol.com> wrote:
! 
!  Since a single word doesn't have any delimiter, is there a way to
!  split it up into letters, or pull out a single letter? 
!  I'm trying to take the first letter off a word and store it in a
!  variable. Thanks for any tips. 

perldoc -f split
perldoc -f substr

these should provide the information you need to answer your two
questions (respectively) --- the latter being the more relevant 
(but not the only) alternative for your problem statement

regards
andrew


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

Date: Sun, 20 Jun 1999 23:04:40 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: cgi query error
Message-Id: <1dtpx8d.joved31sp1scgN@p7.tc8.metro.ma.tiac.com>

Jonathan Stowe <gellyfish@gellyfish.com> wrote:

> What didnt you understand about :
> 
> 
>        Can't call method """"%s"""" without a package or object
>            reference

I don't understand why there are so many quotes!

:)

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
perl -e '$_="\012534`!./4(%2`\cp%2,`(!#+%2j";s/./"\"\\c$&\""/gees;print'


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

Date: 21 Jun 1999 03:57:47 GMT
From: bismuti@cs.fsu.edu (Peter Bismuti)
Subject: CGI.pm: submit + image?
Message-Id: <7kkd7r$838$1@news.fsu.edu>

I would like to use the submit function that display an image instead of 
the standard button and label.  I do NOT mean an image_button, which does 
not allow you to pass back a value with the name, just the coordinates 
where you clicked on the image.  I want it to behave *exactly* like a regular 
submit button just with an image displayed instead of the normal labeled 
button.  Can this be done?  If not this is a major oversite in...CGI?...CGI.pm?

Thanks!


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

Date: 20 Jun 1999 18:03:12 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Cure for document deficiency
Message-Id: <slrn7mqspb.k1b.abigail@alexandra.delanet.com>

Uri Guttman (uri@sysarch.com) wrote on MMCXIX September MCMXCIII in
<URL:news:x7r9n68x72.fsf@home.sysarch.com>:
## 
## tom c. reciting the perl docs on tape or cd.

In English, Spanish, French, German and Portuguese!


[Batteries not included]
[Void were prohibited]
[Costs more in Canada]
[5c value in DE]


Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 21 Jun 1999 03:33:24 GMT
From: posting.account@lynxview.com (William Herrera)
Subject: Re: dbmopen as opposed to tie -- for a database
Message-Id: <376db01b.120291580@news.rmi.net>

On Sun, 20 Jun 1999 22:18:55 GMT, hiro<aw096@chebucto.ns.ca> wrote:

>	I am using dbmopen
>
>	dbmopen (%names,"names",0666) || die "error or something : $!";
>	
>	I have been told that dbmopen is depreciated, and instead to use
>tie. I am just learning perl(chapter 4 of the llama book right now) and
>the perldoc perltie doccumentation was suffeciently complex enough to
>confuse me. 
>	dbmopen seems to be a lot simpler in its implementation, and less
>typing, is it still good practice to use?

If the code is only going to be used a few times, why not? If you
expect to be still using it in a few years, avoid deprecated
featiures. Somebody may neglect to include them someday.

>	What is the syntax for opening a file as a hash with tie?

tie(%hash, 'SDBM_File', $filename, O_RDWR|O_CREAT, 0666)
  || die "ERROR: Could not open SDBM database $filename: $!";
untie %hash;

--or--

use DB_File;  # install it first
tie(%names, 'DB_File', "names");
untie(%names);

But watch out! Remember that dbmopen uses different databases
depending on what is installed on the system -- see I think the
AnyDBM_File documentation. Avoid mixing mix dbmopen and tie when
working with any given database file.

---
The above from: address is spamblocked. Use wherrera (at) lynxview (dot) com for the reply address.


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

Date: 20 Jun 1999 17:36:55 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: deleting part of a string
Message-Id: <slrn7mqr82.k1b.abigail@alexandra.delanet.com>

Hasanuddin Tamir (hasant@trabas.co.id) wrote on MMCXIX September MCMXCIII
in <URL:news:Pine.LNX.3.96.990621012916.17964A-100000@borg.intern.trabas.co.id>:
&& On 18 Jun 1999, Abigail wrote:
&& 
&& abigail] JQ (pigs_can_fly@mindless.com) wrote on MMCXVII September MCMXCIII in
&& abigail] <URL:news:376a79fc.62397051@news.cyberway.com.sg>:
&& abigail] // 
&& abigail] // I need to delete whatever follows the LAST occurence of /, including
&& abigail] // the last /
&& abigail] 
&& abigail] 
&& abigail] s{/[^/]*$}{};
&& 
&& or,
&& 
&& use File::Basename;
&& $string_without_whatever_follows_last_slash_including_itself =
&&    dirname($original_string);


Now, why would you use something that uses a module, is longer to type,
and isn't portable instead of 12 character substitution?



Abigail
-- 
perl -wle '(1 x $_) !~ /^(11+)\1+$/ && print while ++ $_'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 21 Jun 1999 03:21:53 GMT
From: posting.account@lynxview.com (William Herrera)
Subject: Re: File modification time question...
Message-Id: <376daceb.119475916@news.rmi.net>

On Mon, 21 Jun 1999 01:26:28 GMT, Mitch <portboy@home.com> wrote:

> However, how can I continually poll this directory - in
>the background (meaning other stuff in the script can continue
>executing) until I see that the modification time has changed since I
>last checked, and then go and do some command (if the /foo) has been
>modified?

Direct solutiuon: use the beta threaded perl. But having never used it
myself, better you get input from thise who have.

Another good solution in current Perl practice
system("detach perl -w mynewprocess.pl"); 
or system("start perl -w  mynewprocess.pl")
or use fork()

OTOH, as long as the other processing is not time critical, why not
just put the "other stuff" in a loop which includes a sleep() call and
the file check? 

while(1) {
    dostuff();
    do_other_stuff() if( target file was smodified ) ;
    sleep(60);
}




---
The above from: address is spamblocked. Use wherrera (at) lynxview (dot) com for the reply address.


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

Date: Mon, 21 Jun 1999 04:21:55 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: function to read a line & return it
Message-Id: <376DBDA3.9542AF09@home.com>

[posted & mailed]

Eric Bohlman wrote:
> 
> Rick Delaney (rick.delaney@home.com) wrote:
> : [Aside] Just what exactly is the definition of 'script kiddie', that I
> : see mentioned here so often?  I think I resemble that remark.
> 
[good description snipped]

Thanks for that.  I was beginning to think it referred to
non-professional programmers in general.  Which, if true, would really
bug me.  One of the nicest things about Perl IMHO is its availability to
the masses (incessant CGI questions aside).

You shouldn't have to be a carpenter to use a hammer (but you should
know which end to hit the nail with).

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 20 Jun 1999 21:39:53 -0700
From: Mike Coffin <mhc@Eng.Sun.COM>
Subject: Re: function to read a line & return it
Message-Id: <8p6iu8ixj3a.fsf@Eng.Sun.COM>

"John A. Grant" <zjagrantz@znrcanz.gcz.ca> writes:

>     It seems 'fragile' to rely on it getting the proper context to
>     determine what "return;" should actually return.  After all,
>     "sub" doesn't exactly specify the type of the returned value.
>     I'm not used to letting the interpreter make these decisions.

This is a fundamental and pervasive feature of Perl, so if you want to
use Perl you have to get used to it.  (Most languages have their
obsessive little quirks; chalk this one up along side Python's
whitespace and Lisp's parentheses.)

-mike


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

Date: 20 Jun 1999 18:12:43 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Garbage collection question
Message-Id: <slrn7mqtb6.k1b.abigail@alexandra.delanet.com>

Eivind Trondsen (eivind@solbors.no) wrote on MMCXIX September MCMXCIII in
<URL:news:376D3A80.8D294625@solbors.no>:
[] 
[] Hi
[] 
[] I am migrating a large mass of users from one database to another, and
[] the process involves some mailsending and password generation, so I rely
[] on my favorite language rather than do it all on the SQL level.
[] 
[] This means I'll have a large array of hashes in memory. My question is
[] this;
[] 
[] Will the construct
[] 
[] while ( $user = pop @$users ) { 
[] 	...
[] }

The problem with the above approach is that it will stop as soon as
it hits a value in @$users that Perl thinks is 'false'. The second 
problem is that is destructs the @$users array, you can't use it again.
If you want to use the while () construct, and don't mind destroying
@$users, the following makes sure you iterate over all users:

while (@$users) {
    $user = pop @$users;
    ...
}

Also note that by using pop() you are iterating in reverse order.

[] be better than
[] 
[] foreach $user ( @$users ) { 
[] 	...
[] }

This will iterate over the @$users array (aliasing $user to the
various elements) without destroying @$users.

[] in that it will allow the array elements (hashes) to be garbage
[] collected as I go along? I believe it is so, but would like confirmation
[] from someone more guru than myself (I'm _positive_ someone that fits
[] that bill must exist somewhere :-)

Yes, the first alternative will decrease the refcount of the elements of
the array elements as you walk along. If nothing else points to those
scalars, their memory should be released, and available to be reused
by Perl. AFAIK, the memory of the array itself isn't freed during the
process.

Of course, if these memory issues are important for you, you might want
to write your program such that it never has all those hashes at once
in memory.


Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 21 Jun 1999 01:09:07 -0700
From: "Jim Bell" <jbell@263.net>
Subject: how to do this in a perl program
Message-Id: <376dc925@nemo.idirect.com>

Hi, all,

How can I do something like this in a perl CGI program:

#,,, blah,blah
when a user hits the submit button, the corresponding
cgi program will take the user to a page  which says
" This will take about ten minutes, please wait..." immediately.
At the same time, the cgi program works some data processing.
and when it's done it will bring the user to
another page which shows the results.

Any suggestions will be appreciated.

----
Regards,
JB





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

Date: Mon, 21 Jun 1999 14:18:31 +1000
From: "Shannon McCoy" <helpdesk1@midcoast.com.au>
Subject: How to output the current perl script in memory
Message-Id: <W1jb3.103$t01.13128@nsw.nnrp.telstra.net>

I have been wondering how to output the current script in memory to disk, as
I plan to make a program that can be changed while it is running, and need
those changes to be reflected in the original file.
I would be doing an eval on an input string that redefines subroutines and I
can't seem to find a way to output all the changes.




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

Date: 20 Jun 1999 17:46:15 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to remove space
Message-Id: <slrn7mqrpi.k1b.abigail@alexandra.delanet.com>

weicai@my-deja.com (weicai@my-deja.com) wrote on MMCXIX September
MCMXCIII in <URL:news:7kj9j1$lic$1@nnrp1.deja.com>:
^^ Hi, Friend

You must have made a mistake. It looks like you posted your email
on Usenet instead of mailing it to your friend.

^^ I am wondering if anyone know the right way to
^^ remove the spaces at the begin of a new line

RTFFAQ.


Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 20 Jun 1999 18:14:20 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: how to remove spaces in a line
Message-Id: <slrn7mqte3.k1b.abigail@alexandra.delanet.com>

weiq@cs.dal.ca (weiq@cs.dal.ca) wrote on MMCXIX September MCMXCIII in
<URL:news:7kjag6$lrr$1@nnrp1.deja.com>:
'' Hi, Friends


You don't make friends here by repeatedly asking the same question.
Specially not if they are found in the FAQ.



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 20 Jun 1999 17:48:30 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to use svrmgrl commands in Perl CGI
Message-Id: <slrn7mqrtn.k1b.abigail@alexandra.delanet.com>

James Liang (james@guangzhou.sgi.com) wrote on MMC September MCMXCIII in
<URL:news:7ivgf2$hur9s@fido.engr.sgi.com>:
** 
** We have a problem trying to use svrmgrl commands in a Perl CGI script:
** 
** #! /usr/bin/perl5
** 
** This script runs correctly from command-line,


Then there aren't any Perl problems. Perhaps you should contact Oracle 
tech support?



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 21 Jun 1999 05:56:17 GMT
From: Jim Monty <monty@primenet.com>
Subject: Re: Interpreting MS-ASCII - anyone have a filter?
Message-Id: <7kkk61$1cv$1@nnrp02.primenet.com>

Uri Guttman <uri@sysarch.com> wrote:
> Larry Rosler <lr@hpl.hp.com> wrote:
> > Abigail <abigail@delanet.com> wrote:
> > > s/([\x80-\x9F])/$t{$1} || ""/eg;  # Replace all characters in the range
> > >                                   # 0x80 - 0x9F with their translation,
> > >                                   # squish it if there's no translation.
> > > Note that this wouldn't work if there's a char you would want to
> > > replace with 0.
> >
> > s/([\x80-\x9F])/defined $t{$1} && $t{$1}/eg;
>
> i think s/defined/exists/ would look better. if someone mapped a hex
> code to undef yours would fail but that is a stupid thing to do.
>
> > Maybe someone should name this idiom after me. No one else seems
> > to use it! :-)
>
> i dub this the rosler substitution!
>
> (but only if it uses exists)

I continue to struggle to learn Perl and its countless popular
"idioms." What, pray tell, is wrong with this?

    s/([\x80-\x9F])/exists $t{$1} ? $t{$1} : ''/eg;

I _do_, at least, know what's wrong with this--thanks to MRE:

    s/[\x80-\x9F]/exists $t{$&} ? $t{$&} : ''/eg;

-- 
Jim Monty
monty@primenet.com
Tempe, Arizona USA


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

Date: Mon, 21 Jun 1999 00:41:09 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: newbie question...
Message-Id: <1dtq0y9.17xb0g1yvij8eN@p7.tc8.metro.ma.tiac.com>

<morrisTHIS@cogent.net> wrote:

> Given a code fragment:
> 
>  opendir THEDIR, "$basepath$ARGV[0]" || die "Unable to open directory:
> $!";

Precedence.  This will die if "$basepath$ARGV[0]" is false, but will not
die if opendir() fails.

opendir(THEDIR, "$basepath$ARGV[0]")
  || die "Unable to open directory: $!";

opendir THEDIR, "$basepath$ARGV[0]"
  or die "Unable to open directory: $!";


>  @allfiles = readdir THEDIR;
>  closedir THEDIR;
> print "<p>allfiles=\"@allfiles\"</p>\n";
> 
> and on the web page it lookslike this:
> allfiles=". .. 930606818.dat 930606861.dat"
> 
> I've been beating my head agains the wall all day trying to come up with
> 
> a simple, robust way to hack the top two items off the array so that
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

That, to me, says splice().


> I could add a line or two ofter the print statement, then repeat the
> print statement and have it produce:
> 
> allfiles="930606818.dat 930606861.dat"

How about...

while (@allfiles) {
  print '<p>allfiles="', join(' ', splice @allfiles, 0, 2), qq{"</p>\n};
}

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 21 Jun 1999 00:41:12 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Parsing bug in Perl?
Message-Id: <1dtq1v8.1gnr4u71n2qdlvN@p7.tc8.metro.ma.tiac.com>

Tom Phoenix <rootbeer@redcat.com> wrote:

> On Sat, 19 Jun 1999, Sean McAfee wrote:
> 
> > sub foo { 4 }  sub bar { foo <=> 5 }

> As you said in your later post, explicitly using an empty prototype will
> fix the confusion - on your part, that is; perl was never confused. :-)

Another way to fix this would be to call foo with an empty argument
list:

sub foo { 4 }  sub bar { foo() <=> 5 }

In a case where foo is not a constant subroutine, that might be useful.


By the way, Programming Perl, 2nd ed. has a chart of page 84 of
characters which the Perl tokener interprets differently depending on
whether it is expecting a term or an operator.

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 21 Jun 1999 00:41:10 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Parsing bug in Perl?
Message-Id: <1dtq1sc.12vikbe4h0xjwN@p7.tc8.metro.ma.tiac.com>

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

> Tom Phoenix wrote:
> 
> >Is it because me's reply dates from 2 AM local time. Jesus that you came
> >to see me today? Please go on.
> 
> I can't make head not tail of this sentence.

It looks like something Eliza would say...  :)

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 21 Jun 1999 04:21:08 GMT
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: Perl scripts slows down servers?
Message-Id: <7kkejk$u4u$1@lennon.postino.com>

X-Newsreader: TIN [version 1.2 PL2]

Larry Rosler (lr@hpl.hp.com) wrote:
: Kernighan & Pike, The Practice of Programming (1999), p. 81, has a 
: comparative performance and code-size chart for a particular program.  
: Here are excerpts:
:        250 MHz    400 MHz       Lines of
:        R10000     Pentium II   source code
: Java   4.9 sec    9.2 sec         105
: Perl   1.8 sec    1.0 sec          18
: A good book (as you can see :-)!

Huh?! Moving from the R1000 to the Pentium, Perl runs faster while
Java runs slower? Why do they not at least both move in the same 
direction? 

--
Danny Aldham     Providing Certified Internetworking Solutions to Business
www.postino.com  E-Mail, Web Servers, Mail Lists, Web Databases, SQL & Perl


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

Date: Mon, 21 Jun 1999 04:03:49 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: printing multiple lines
Message-Id: <376DB964.C797539C@home.com>

[posted & mailed]

ted fiedler wrote:
> 
> when i find this tag how do i not only print the first line but the two
> lines which come after it??? also i want to remove the 015???
> thanks in advance...
> 
> while(<TDAT>) {
>  if (/015/) {
>   print $_;

Okay, now read and print two more lines here.

    print scalar <TDAT> for (1 .. 2);

I leave the possibility that there aren't two following lines to you.

perldoc -f eof

As for removing the 015, you already know how to use the m// operator to
match it.  Look up s/// in perlop to see how to get rid of it.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 20 Jun 1999 21:05:18 -0700
From: Mike Coffin <mhc@Eng.Sun.COM>
Subject: Re: Questions
Message-Id: <8p6k8syxkox.fsf@Eng.Sun.COM>

"news.wizard.net" <no@way.com> writes:

> What is the easiest way to remove say the first 5 elements of an array?
> Makeing the 6 the first.

splice @array, 0, 5;


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

Date: 20 Jun 1999 18:28:32 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Questions
Message-Id: <slrn7mqu8s.k1b.abigail@alexandra.delanet.com>

news.wizard.net (no@way.com) wrote on MMCXIX September MCMXCIII in
<URL:news:7kjn1p$146$1@remarQ.com>:
** chop removes the last character of a string but supose I want to remove the
** first caracter?

reverse the string, chop it, reverse it again.

Or use the following subroutine:

    sub pohc (@) {
        my  $r;
        foreach my $s (@_  ?
                       @_  :
                       $_) {
            $s = reverse $s;
            $r = chop    $s;
            $s = reverse $s;
        }
        $r;
    }
        

** What is the easiest way to remove say the first 5 elements of an array?
** Makeing the 6 the first.

$[ = 6;


Abigail
-- 
perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 21 Jun 1999 00:41:13 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Server Running Perl - Resources?
Message-Id: <1dtq39a.1jubrqu1evi0fgN@p7.tc8.metro.ma.tiac.com>

Troy Knight <troyknight@troyknight.eurobell.co.uk> wrote:

> This isn't the best place to ask about servers but I guess your all pretty
> knowledgable about servers seeing as most people set them up when they
> program in perl.

So?  Most people use keyboards when they program in Perl, but this isn't
the right place to ask about keyboards.

In fact, I would not be surprised if most people who program in Perl
have _never_ set up a server.

Get a clue, then go post your query in an appropriate newsgroup.

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 21 Jun 1999 04:41:20 +0200
From: Ask Bjoern Hansen <ask@netcetera.dk>
Subject: Re: Very very short tutorial about modules
Message-Id: <m3ogia5l7z.fsf@ratatosk.netcetera.dk>

mjd@plover.com (Mark-Jason Dominus) writes:

 ...
> 1% of the space.  The strategy I took was to not explain anything at
> all, but to try to provide examples that explained themselves.

Very nice.

A few comments,

 o The modules should use strict
 o They should contain a small POD
 o "The very very short tutorial ..." text should include references
   to "what to read next"

all IMHO of course. 

I understand that at least the two first things would kinda defeat
your intention by making the files bigger, but I think learning people
to always use strict and include a POD is important "enough".

-- 
ask bjoern hansen - <http://www.netcetera.dk/~ask/>


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

Date: 20 Jun 1999 17:38:38 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: What is functional difference between .pm and .pl?
Message-Id: <slrn7mqrb9.k1b.abigail@alexandra.delanet.com>

Ilya Zakharevich (ilya@math.ohio-state.edu) wrote on MMCXIX September
MCMXCIII in <URL:news:7kjj93$t7t$1@mathserv.mps.ohio-state.edu>:
'' [A complimentary Cc of this posting was sent to Abigail
'' <abigail@delanet.com>],
'' who wrote in article <slrn7mngl1.lri.abigail@alexandra.delanet.com>:
'' >				    I don't need syntax highlighting, I
'' > already know Perl.
'' 
'' Judging my most of your signatures, you do need them.  Most of them
'' lose all the charm with the highlighted syntax.


That's a reason _not_ to use them. I prefer having the charm.


Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 21 Jun 1999 00:41:14 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: What is functional difference between .pm and .pl?
Message-Id: <1dtq4cm.c9x34e1wukie5N@p7.tc8.metro.ma.tiac.com>

Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:

> Abigail <abigail@delanet.com> wrote:
> >           I don't need syntax highlighting, I
> > already know Perl.
> 
> Judging my most of your signatures, you do need them.  Most of them
> lose all the charm with the highlighted syntax.

Wow...  Having an editor that does syntax-highlighting is cool enough...
But Perl syntax-highlighting in your newsreader??  That's just too cool!

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
  Unfortunately, I have no syntax-highlighting-unfriendly signatures.


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

Date: Mon, 21 Jun 1999 02:46:53 GMT
From: kellan1@my-deja.com
Subject: XS question: problem with adv. perl example
Message-Id: <7kk92r$uj0$1@nnrp1.deja.com>

I thought I would start playing with extending perl and so to get started
I walked through the XS example(Fractal.pm) in "Advanced Perl
Programming" by Srinivasan.

Having setup the c source, and the Makefile.PL, and having 'make'ed, and
'make install'ed the module with no apparent difficulty, I thought I
would be ready to test this new module.  However when I call the function
defined in the c code "draw_mandel" I get the error:

Can't locate auto/Fractal/draw_mandel.al

This like some problem with AutoSplit(just a guess really), but if
somebody could tell me what this problem might be symptomatic of I would
really appreciate it.  Is the c code not compiling properly? Is something
mis-installed? Any thoughts?

Thank you,
Kellan Elliott-McCrea
kellan1@my-Deja.com


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

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

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