[9048] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2666 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 21 17:07:36 1998

Date: Thu, 21 May 98 14:01:16 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 21 May 1998     Volume: 8 Number: 2666

Today's topics:
    Re: "Tee" question (Mark-Jason Dominus)
    Re: .= food for thought? (Mike Stok)
    Re: .= food for thought? <lr@hpl.hp.com>
    Re: .= food for thought? (Belg4mit)
    Re: .= food for thought? (Craig Berry)
    Re: Bible References converted into Text (John Porter)
        Environment variables mdlbikes@walrus.com
    Re: Environment variables (Mike Stok)
    Re: Environment variables <rootbeer@teleport.com>
        ExtUtil::MakeMaker wish (Ken Williams)
    Re: ExtUtil::MakeMaker wish (Ilya Zakharevich)
    Re: Finding Holidays (Clinton Pierce)
        Format for top of page; adding system date kmacklin@my-dejanews.com
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 21 May 1998 15:04:39 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: "Tee" question
Message-Id: <6k1ts7$5vv$1@monet.op.net>
Keywords: case congressman Corbett open


>open (STDERR,">STDOUT");
>in order to get the stderr directed to the same place,
>it doesn't seem to work.

That creates a new file in the current directory named `STDOUT' and
sends standard error to it.  You should have done

	open(STDERR, ">&STDOUT");



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

Date: 21 May 1998 19:07:02 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: .= food for thought?
Message-Id: <6k1u0m$re9@news-central.tiac.net>

In article <1998052118564300.OAA16795@ladder01.news.aol.com>,
Belg4mit <belg4mit@aol.com> wrote:
>Why doesn't Perl have a .= ? Seems like ot would be rather useful.
>By that same token, why not =. ? .= is one of the few operators where
>it would be useful to have the operation done in reverse... += & =+ are
>the same... the only other one I can think of is /= & =/

But perl does have a .= operator - have you tried it?

  $x = 'foo';
  $x .= 'bar';

should leave $x containing the string foobar.  In old C =- meant what -=
means now, but was changed as x=-2; might not do what the programmer
expected (I think...)

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@colltech.com                  |            Collective Technologies (work)


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

Date: Thu, 21 May 1998 12:11:41 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: .= food for thought?
Message-Id: <6k1u9h$i0o@hplntx.hpl.hp.com>

Belg4mit wrote in message
<1998052118564300.OAA16795@ladder01.news.aol.com>...
>Why doesn't Perl have a .= ? Seems like ot would be rather useful.
>By that same token, why not =. ? .= is one of the few operators where
>it would be useful to have the operation done in reverse... += & =+ are
>the same... the only other one I can think of is /= & =/
>
>Food for thought

You forgot -= and =- , and perhaps %= and =% .

There was a recent thread on this subject, but I haven't dredged it out
of Dejanews.

--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com





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

Date: 21 May 1998 19:42:48 GMT
From: belg4mit@aol.com (Belg4mit)
Subject: Re: .= food for thought?
Message-Id: <1998052119424800.PAA20959@ladder01.news.aol.com>

There is indeed.. I could of swarn I'd tried it to no avail...

maybe it was =.


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

Date: 21 May 1998 19:58:42 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: .= food for thought?
Message-Id: <6k211i$o0g$1@marina.cinenet.net>

Belg4mit (belg4mit@aol.com) wrote:
: Why doesn't Perl have a .= ? Seems like ot would be rather useful.

So useful, in fact, that Perl does have it. :)

  $a  = 'foo';
  $a .= 'bar';  # $a is now 'foobar'.

See the 'perlop' documentation.

: By that same token, why not =. ? .= is one of the few operators where
: it would be useful to have the operation done in reverse... += & =+ are
: the same... the only other one I can think of is /= & =/

All of these could lead to syntactic ambiguities.  For example, if I say

  $a =.4;

do I mean to assign 0.4 to $a, or to append the string "4" to $a?

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Thu, 21 May 1998 19:52:49 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Bible References converted into Text
Message-Id: <MPG.fce5186dcbe1a49896e5@news.min.net>


Here's my quick hack.
It handles not only cross-chapter ranges, but cross-book ranges, (in
case that ever occurs).

It skips garbage silently.  At least, if it's simply a case of
missing numbers, as in '3:,;:2'.

#!/usr/bin/perl -w


@refs = (
  'gen1:1-10,15,13;3,5,6:3,Act3,5:5-6:3',
  '1king1:1-10,3:,;:2'
);

for $line ( @refs ) {
  my $book;

  for $part ( split( /;/, $line ) ) {
      my $in_verses = 0;
      my( $sep, $chap, $verse );

      my @vv = split( /([-,])/, $part );

      while ( my $tok = shift @vv ) {
        if ( $tok eq '' ) { next; }
        if ( $tok eq '-' or $tok eq ',' ) {
          $sep = $tok;
          next;
        }

        if ( $tok =~ s/^\d*[a-zA-Z]+// ) {
          $book = $&;
          $in_verses = 0;
          $chap = $verse = undef;
        }

        if ( $tok =~ /:/ ) {
          next unless ( length $` and length $' );
          # colon requires both chapter & verse
          $chap = $`;
          $verse = $';
          $in_verses = 1;
        }
        else {
          ( $in_verses ? $verse : $chap ) = $tok;
        }

# the last element is True if this entry is the end of range
# which began (presumably) on the previous entry.

        push @bibrefs, [ $book, $chap, $verse, $sep eq '-' ];
      }
    }
}

for ( @bibrefs ) {
  print ( $_->[3] ? ' -- ' : "\n" );
  print "$_->[0] $_->[1]:$_->[2]";
}


John Porter


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

Date: Thu, 21 May 1998 19:30:34 GMT
From: mdlbikes@walrus.com
Subject: Environment variables
Message-Id: <6k1vcs$tv3$1@nnrp1.dejanews.com>

I want to setup an environment variable that is available to the parent
proccess. In ksh I would do export VAR=VALUE. How do I "export" a variable in
perl?

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


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

Date: 21 May 1998 19:48:47 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Environment variables
Message-Id: <6k20ev$re9@news-central.tiac.net>

section 8 of the FAQ contains this question and a response:

       I {changed directory, modified my environment} in a perl
       script.  How come the change disappeared when I exited the
       script?  How do I get my changes to be visible?

on recent perl installations you can read section 8 by saying

  perldoc perlfaq8

or

  man perlfaq8

or, if it's not installed, visit http://www.perl.com and follow the FAQs
link.

Hope this helps,

Mike

In article <6k1vcs$tv3$1@nnrp1.dejanews.com>,  <mdlbikes@walrus.com> wrote:
>I want to setup an environment variable that is available to the parent
>proccess. In ksh I would do export VAR=VALUE. How do I "export" a variable in
>perl?
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/   Now offering spam-free web-based newsreading


-- 
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@colltech.com                  |            Collective Technologies (work)


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

Date: Thu, 21 May 1998 20:48:17 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: mdlbikes@walrus.com
Subject: Re: Environment variables
Message-Id: <Pine.GSO.3.96.980521134709.16724N-100000@user2.teleport.com>

On Thu, 21 May 1998 mdlbikes@walrus.com wrote:

> I want to setup an environment variable that is available to the parent
> proccess. In ksh I would do export VAR=VALUE. How do I "export" a
> variable in perl? 

All of Perl's environment variables are exported, but you should see what
the FAQ says about changing the environment of the parent process. Hope
this helps!

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



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

Date: Thu, 21 May 1998 16:15:47 -0400
From: ken@forum.swarthmore.edu (Ken Williams)
Subject: ExtUtil::MakeMaker wish
Message-Id: <ken-2105981615470001@news.swarthmore.edu>

Hi,

I'm trying to get my feet thoroughly soaked with MakeMaker.  I'm trying to
convert a few straight-perl (no XS) modules to be more easily installable,
so I let h2xs build a Makefile.PL for me and all that.  Now here's my
question: does everybody add the 'dist' entry to the Makefile.PL:

   'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" }

?  If so, couldn't this be put in by default by h2xs, or be the default
when no 'dist' argument is given to WriteMakefile()?

I ask because almost all of the entries in CPAN are gzipped, and I assume
that people use the 'make dist' option to create their distributions.

Thanks.


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

Date: 21 May 1998 20:28:55 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: ExtUtil::MakeMaker wish
Message-Id: <6k22q7$skn$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Ken Williams
<ken@forum.swarthmore.edu>],
who wrote in article <ken-2105981615470001@news.swarthmore.edu>:
> Hi,
> 
> I'm trying to get my feet thoroughly soaked with MakeMaker.  I'm trying to
> convert a few straight-perl (no XS) modules to be more easily installable,
> so I let h2xs build a Makefile.PL for me and all that.  Now here's my
> question: does everybody add the 'dist' entry to the Makefile.PL:
> 
>    'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" }
> 
> ?

Yes.

>  If so, couldn't this be put in by default by h2xs, or be the default
> when no 'dist' argument is given to WriteMakefile()?

There is no guarantee that gzip is (going to be) around. 

> I ask because almost all of the entries in CPAN are gzipped, and I assume
> that people use the 'make dist' option to create their distributions.

I think CPAN recompresses them anyway.

Ilya


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

Date: 21 May 1998 19:08:47 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
Subject: Re: Finding Holidays
Message-Id: <6k1u3v$h73@eccws1.dearborn.ford.com>

In article <35646ED7.881AF07C@cfa.harvard.edu>,
	Peter Cheimets <pcheimets@cfa.harvard.edu> writes:
>Is there a perl program or subroutine that given a date will determine
>if it is a holiday, or a program that will return a list of the holiday
>dates for a given year?
>
>Thanks

Yes, but it's only been ported for the country of Elbonia.  It also reports
holidays for previous years and several years into the future.

It's widely distributed on most UNIX systems, and this years holidays 
can be accessed by typing:

	cal 1998


-- 
+------------------------------------------------------------------------+
|  Clinton A. Pierce    |   "If you rush a Miracle Man,   | http://www.  |
|  cpierce1@ford.com    |     you get rotten miracles"    | dcicorp.com/ |
| fubar@ameritech.net   |--Miracle Max, The Princess Bride| ~clintp      |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*



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

Date: Thu, 21 May 1998 19:45:32 GMT
From: kmacklin@my-dejanews.com
Subject: Format for top of page; adding system date
Message-Id: <6k208s$v0e$1@nnrp1.dejanews.com>

 I'm trying to create a format using a TOP-OF-PAGE  in Perl 5 on an HP UX
UNIX system that has the system date. Perl is not allowing me to have a user
defined variable in the TOP-OF-PAGE header. Does anybody know if there's any
way of including a system date in the header; there doesn't appear to be an
system	defined special variable for this.



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


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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