[6290] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 912 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 7 16:27:14 1997

Date: Fri, 7 Feb 97 13:00:27 -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           Fri, 7 Feb 1997     Volume: 7 Number: 912

Today's topics:
     Re: "ORDER BY" does not seem to work through ODBC call <chiue@nortel.ca>
     Re: -w switch and the require statement <jander@jander.com>
     Advice: Asynchronous Socket Comm. alex@ceara.net
     Re: ANNOUNCEMENT: Perl documentation and FAQ discontinu (Mark Allman )
     Re: ANNOUNCEMENT: Perl documentation and FAQ discontinu (Joe Hass)
     Re: Commercial success stories using perl. (Scott McMahan - Softbase Systems)
     Re: Division and Rounding <jhi@alpha.hut.fi>
     DNS Lite? (R L Samuell)
     Re: embedding manual line-feeds in Perl output <rootbeer@teleport.com>
     Re: fcntl to lock a file? <jander@jander.com>
     Re: Frivilous request for new Perl function (Abigail)
     Re: function arguments (M.J.T. Guy)
     Re: HELP NEEDED: pb with 'system' (Mike Stok)
     Help: DBM on Perl Win32 (Jim Doubek)
     Re: How to convert a text file of arbitrary length line (Dave Thomas)
     Re: How to peek at next line of STDIN? (repost) <tchrist@mox.perl.com>
     Inserting \n inside the string <Vadim.Parizher@jpl.nasa.gov>
     Is there any module available for Chi-Square-distributi (Danny Lee)
     Re: Nice perl way to generate n! permutations for n=8 ? (Tony Bass)
     open() call under NT (Carsten Schafer)
     Re: Perl 5 package problems <minaret@sprynet.com>
     Re: Perl 5.003 causes segmentation fault on SGI Irix <rootbeer@teleport.com>
     Re: Perl and Crontabs (Mike Stok)
     Re: perl bug? side effect of using != where ne is requi (M.J.T. Guy)
     Re: perl bug? side effect of using != where ne is requi (Joel Earl)
     perl HTTP proxy? <terry@teclata.es>
     Re: Perl vs Korn Shell (Abigail)
     Re: Perl vs Korn Shell <jander@jander.com>
     PERL/NT4.0/IIS2.0 bugs? <iswojtow@sfu.ca>
     Re: print 'undef' in an elegant way ? <rootbeer@teleport.com>
     Problem with call of system (Triantafyllos Marakis)
     Re: regexps challenge - movies.txt (0/1) (Dave Thomas)
     Re: regexps challenge - movies.txt (0/1) (Abigail)
     SIGPIPE in server script - where's the pipe? (Zeus Paleologos)
     Simple simple question (Joe Schulte)
     Re: Simple simple question (Mike Stok)
     Re: Simple simple question (Nathan V. Patwardhan)
     Socket questions Win32 pcarty@eurokom.ie
     Technical Producer Needed--San Francisco (Pmagaf)
     Re: Windows 95 File Commands (Scott McMahan - Softbase Systems)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: Fri, 07 Feb 1997 11:59:42 -0500
From: Hokee Chiu <chiue@nortel.ca>
Subject: Re: "ORDER BY" does not seem to work through ODBC call
Message-Id: <32FB5F7E.3879@nortel.ca>

Hokee Chiu wrote:
> 
> I am writing a query to return information from SQL Server 6.5.
> 
> The query itself works. When I added the "ORDER BY colname"
> the query failed (colname is in same table).
> 
> I am using Perl 5.003 with ODBC to do the work. NT4 server.
> 
> Any hints?

Never mind... I made the stupid mistake. When I used "Order by",
I ran into the famous 20xx byte limit per row on SQL server as
the temporary result table was created.


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

Date: 07 Feb 1997 14:48:53 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: -w switch and the require statement
Message-Id: <7mkkiehm.fsf@jander.com>

mike@stok.co.uk (Mike Stok) writes:

> 
> In article <01bc14d0$540e2ee0$6d9d16cb@dialup.ozemail.com.au>,
> Kim Ryan <kimaryan@ozemail.com.au> wrote:
> >When my programs get fairly large, I like to split them into several files,
> >and include each file with the require statement. This causes the -w switch
> >to issue spurious messages, such as identifier only used once, when in fact
> >it is used more than once, but in a different file to the one I am
> >currently checking. The line numbers that errors are reported on also seem
> >to get confused. Is there any solution to this problem?
> 
> If you're using perl 5 you can use vars.  Assuming I have
> 
> $ cat try.pl
> #!/usr/local/bin/perl -w
> 
> require 'other.pl';
> 
> print "$x\n";
> $ cat other.pl
> $x = 5;
> $ ./try.pl
> Name "main::x" used only once: possible typo at ./try.pl line 5.
> 5
> 
> Then adding
> 
> use vars qw/$x/;
> 
> near the top of try.pl shuts the warning up and lets you have a place to
> declare all your globals.
> 
> With regard to the confused line numbering, do you have multilined
> statements or are things seriously out to lunch?
> 
> Hope I'm not barking up the wrong tree,

Or, perhaps, add

{
   local($^W) = 0;
   ...
}





















-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: 7 Feb 1997 05:11:06 -0800
From: alex@ceara.net
Subject: Advice: Asynchronous Socket Comm.
Message-Id: <5df9la$lkd@lana.zippo.com>

I am somewhat of a beginner with regards to socket programming, if someone
could give me some pointers on the following I would greatly appreciate it.

I am trying to implement 2-way socket communication between a Java Applet Client
and a Perl Server. I am using the server example from the second edition
of the Camel book p. 350-351.

I was able to get the output sent to the applet by the server but I was not
able to get the Server to receive from the applet.

The code -- note the modification that I tried in order to get something
from the applet.

#!/usr/bin/perl
require 5.002;
use strict;
BEGIN { $ENV{PATH} = '/usr:/bin' }
use Socket;
use Carp;
$|=1;
sub spawn;  # forward declaration
sub logmsg { print "$0 $$: @_ at ", scalar localtime, "\n" } 
my $port = shift || 2345;
my $proto = getprotobyname('tcp');
socket(SERVER, PF_INET, SOCK_STREAM, $proto)        || die "socket: $!";
setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, 1)     || die "setsockopt: $!";
bind(SERVER, sockaddr_in($port, INADDR_ANY))        || die "bind: $!";
listen(SERVER,5)                                    || die "listen: $!";
logmsg "server started on port $port";
my $waitedpid = 0;
my $paddr;
sub REAPER { 
  $SIG{CHLD} = \&REAPER;  # loathe sysV
  $waitedpid = wait;
  logmsg "reaped $waitedpid" . ($? ? " with exit $?" : '');
}
$SIG{CHLD} = \&REAPER;
for ( $waitedpid = 0; 
    ($paddr = accept(CLIENT,SERVER)) || $waitedpid; 
    $waitedpid = 0, close CLIENT) 
{
  next if $waitedpid;
  my($port,$iaddr) = sockaddr_in($paddr);
  my $name = gethostbyaddr($iaddr,AF_INET);
   logmsg "connection from $name [", 
          inet_ntoa($iaddr), "] 
          at port $port";
  spawn sub { 
      print "Hello there, $name, it's now ", scalar localtime, "\n";
# ADDITIONAL CODE STARTS HERE
         my $buf;
         while ($buf=<STDIN>) {
            print $buf;
         }
# END ADDITIONAL CODE
      exec '/usr/games/fortune' 
          or confess "can't exec fortune: $!";
  };
} 
sub spawn {
  my $coderef = shift;
  unless (@_ == 0 && $coderef && ref($coderef) eq 'CODE') { 
      confess "usage: spawn CODEREF";
  }
  my $pid;
  if (!defined($pid = fork)) {
      logmsg "cannot fork: $!";
      return;
  } elsif ($pid) {
      logmsg "begat $pid";
      return; # i'm the parent
  }
  # else i'm the child -- go spawn
  open(STDIN,  "<&CLIENT")   || die "can't dup client to stdin";
  open(STDOUT, ">&CLIENT")   || die "can't dup client to stdout";
  ## open(STDERR, ">&STDOUT") || die "can't dup stdout to stderr";
  exit &$coderef();
} 


When executed, the applet does connect to the server but then the server
hangs right at the point where I am trying to get input from the applet.
In fact, this hangs the applet also. I can only back out of the applet once
I kill the server.

I actually tried several other loops, like read, etc, but still nothing.
I read in a posting that another socket would have to be opened to communicate
in the other direction. I could do that, but I just wanted to make sure that
this was the case. It seems that Java permits communication in both 
directions over a single socket as long as each side takes its turns.
Can Perl do this? (Btw, imho the world would be a better place if Perl
was the chosen Browser language and not Java).

For example, how would one go about making an echo client-server model using
Perl. This would be, the client would type and the server would echo back what
the client typed. Does this have to be two sockets or can it be over the same
one?

Help needed 3 degrees south of the equator!

Many thanks,
Alex Panagides
Ceara, Brazil


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

Date: 7 Feb 1997 17:15:52 GMT
From: allman@pat.mdc.com (Mark Allman )
Subject: Re: ANNOUNCEMENT: Perl documentation and FAQ discontinued
Message-Id: <5dfo08$bke$1@mars.gbtech.net>

In article <5ddt96$9gh$1@csnews.cs.colorado.edu>, Tom Christiansen <tchrist@mox.perl.com> writes:
|> As of the next release of Perl, no documentation or examples will
|> be shipped, since no one reads them anyway.  Furthermore, the FAQ
|> is also discontinued.  Please remove copies of any of this documentation
|> wherever you may find it, since it's obvious from the postings in this 
|> group that it has never done a bit of good.
|> 
|> mot--
|> -- 
|> Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com
|> echo $package has manual pages available in source form.
|> echo "However, you don't have nroff, so they're probably useless to you."
|>     --Larry Wall in Configure from the perl distribution

Me thinks me heres a tad bit of (100% justified) frustration.

We pray that Tom's post is laced with sarcasm.

-- Mark Allman
-- Sr. Engineer, McDonnell Douglas Aerospace,  allman@pat.mdc.com
-- Software consulting (Perl, C, Python, ...), ghost@ghost.neosoft.com
-- (see: http://pup.princeton.edu/titles/5857.html)


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

Date: 7 Feb 1997 14:45:21 GMT
From: jhass@mrc.unm.edu (Joe Hass)
Subject: Re: ANNOUNCEMENT: Perl documentation and FAQ discontinued
Message-Id: <5dff61$m5i@lynx.unm.edu>

In article <5ddt96$9gh$1@csnews.cs.colorado.edu>, Tom Christiansen <tchrist@mox.perl.com> writes:
|> As of the next release of Perl, no documentation or examples will
|> be shipped, since no one reads them anyway.  Furthermore, the FAQ
|> is also discontinued.  Please remove copies of any of this documentation
|> wherever you may find it, since it's obvious from the postings in this 
|> group that it has never done a bit of good.

Hey Tom-

I'm pretty sure this is tongue-in-cheek, but just in case it's not...

I, too, experience a momentary rise in blood pressure when I see a post
like this (fictional) one:

lazybones@help.me.now writes:
>
> So what does chomp do and how can I use it to make my
> CGI stuff really kewl??
> Send me email because I get bored reading this group.

Thank goodness for KILL files.

On the other hand, there are probably many, many more perl users out
there, like me, who refer to the documentation constantly...and
appreciate very much that it is available.  I read this news group 
faithfully and often save tidbits of wisdom posted by yourself and others.

So, to you and all of the other helpful folks in perldom...keep the faith.

Thanks,
Joe
---------------------------------------------------------------------------
== K. Joseph Hass            ==   Microelectronics Research Center       ==
== jhass@mrc.unm.edu         ==   801 University Blvd SE, Suite 206      ==
== (505) 272-7055            ==   Albuquerque, NM 87106                  ==


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

Date: 7 Feb 1997 20:05:17 GMT
From: softbase@mercury.interpath.com (Scott McMahan - Softbase Systems)
Subject: Re: Commercial success stories using perl.
Message-Id: <5dg1tt$n6c@redstone.interpath.net>

Steve Vanechanos (stevev@dynamicweb.com) wrote:
: I am looking for significant commercial success stories where perl is
: being used.

Here's one: I'm writing a translation unit in perl to help people
restructure existing code to work with our product. It's going to
be a smiley-face checklist feature that'll make people want our
product.

Scott



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

Date: 07 Feb 1997 20:00:27 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Division and Rounding
Message-Id: <oee9150ijic.fsf@alpha.hut.fi>


> There are some numbers that can't be accurately represented in a
> typical floating point format, and sometimes

Ahem, I am not quite certain any more on my number theory but isn't it
that _most_ numbers can't be accurately represented in a typical
floating point format. Floating point numbers are truncated sums of
finite series of terms of the form 2^i, that leaves all of the
irrational and most of the rational numbers out in the cold... 1/3,
1/5, 1/7, because of the 1/5 also 0.1, 0.01, 0.001, etc cannot be
accurately represented, ever.  E.g. 1/10 = 1/16 + 1/32 + 1/256 + 1/512 + ...
            ____
that is, 0.00011 ,an endlessly repeating fractional number. No number of
                2

bits in a floating point number is ever gonna be enough to hold them all.
The floating point numbers are convenient smoke and mirrors which work
quite well for simple things, but often the seams show...

-- 
$jhi++;
# Jarkko Hietaniemi <URL:http://www.iki.fi/~jhi/> <URL:mailto:jhi@iki.fi>
# Lost interest?  It's so bad I've lost apathy.
# Not speaking for any past, present, or future employers.


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

Date: 7 Feb 1997 19:07:21 GMT
From: samuell@cahaba.cis.uab.edu (R L Samuell)
Subject: DNS Lite?
Message-Id: <5dfuh9$731@juniper.cis.uab.edu>


I have a fixed IP address with one ISP and a dynamic IP address
with another.  I would like to setup a simple DNS server at the
fixed location that would need to do only two things:  Provide
my current dynamic address to anyone doing a DNS query to it and
allow me to easily and remotely, but with some security, update 
that dynamic address when it changes.  I really do not want to 
install BIND or learn the details of DNS.

I am familiar with James Brown's CGI Perl script for registering
dynamic IPs on the Web but I want to have something that would 
be more DNS-like, even transparent to the service.

I would be very surprised if something like a "DNS Lite" server
didn't already exist somewhere, possibly in Perl.

Any comments or suggestions would be appreciated while scripts
would be applauded particularly if they will run under Perl for
OS/2.


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

Date: Fri, 7 Feb 1997 10:20:13 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Coburn Watson <cpw@slip.net>
Subject: Re: embedding manual line-feeds in Perl output
Message-Id: <Pine.GSO.3.95.970207101548.3726S-100000@linda.teleport.com>

On Thu, 6 Feb 1997, Coburn Watson wrote:

> Does anyone know how to print a manual linefeed to an output file from
> Perl. 

Sure; just put a manual linefeed (whatever you mean by that :-) into a
variable like $ml. Then, whenever you need one in the file

   print FILE $ml;	# put manual linefeed into FILE

I suspect that by a manual linefeed you mean some kind of escape sequence
which signifies a linefeed. Once you find out what that sequence is, it
should be easy to do what you need. 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: 07 Feb 1997 14:43:52 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: fcntl to lock a file?
Message-Id: <afpgiepz.fsf@jander.com>

tim@pipex.net (Tim Goodwin) writes:

> 
> In article <ri3ev9jppa.fsf@viman.com>, Matt Cline  <gandalf@viman.com> wrote:
> >I'm trying to use fctnl to lock a file.  However, I keep on getting
> >a "Bad file number" error, no matter what file number I give it.
> 
> Probably, you're trying to apply an exclusive lock through a file
> descriptor open only for reading, or a shared lock through a file
> descriptor open only for writing.  Neither of these makes sense,
> so the system won't let you do it.
> 
> Shared locks can only be applied through filehandles open for reading,
> and exclusive locks can only be applied through filehandles opened for
> writing.
> 
> >Does someone have some existing code using fcntl that works?
> 
> I'd recommend using the File::Lock module.

Unfortunately file locking doesn't currently seem to work on all
architectures :-(

-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: Fri, 7 Feb 1997 17:34:13 GMT
From: abigail@ny.fnx.com (Abigail)
Subject: Re: Frivilous request for new Perl function
Message-Id: <E58u51.3up@nonexistent.com>

On 7 Feb 1997 02:14:41 GMT, William R. Somsky wrote in comp.lang.perl.misc:
++ 
++ I suppose if we don't worry about trying to make it a pure function
++ w/out side effects, and let "chew" modify it's argument(s) just like
++ "chomp", but just to return the "what's left" part instead of "what's
++ been chomped", we might be able to do:
++ 
++ sub chaw { chomp @_ ; return @_ ; }
++ 
++ Or is there still something better?
++ (Or is this perhaps broken, I didn't test it...)

Depends what you think is "better". If you want shorter, and prototyped:

sub chaw (@) {chomp @_;@_;}

Doesn't that look nice?



Abigail



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

Date: 7 Feb 1997 16:56:59 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: function arguments
Message-Id: <5dfmsr$gpj@lyra.csx.cam.ac.uk>

Simon Williams  <williams@mod5.ag.rl.ac.uk> wrote:

 [snip]

>produces    
>
>   foo
>   bar
>   foo
>
>NOT 
>
>   foo
>   bar
>   bar
>
>as I was expecting.

I deduce that you are running perl4, which is historical.   In particular,
it had this bug.   All versions of Perl5 have this mended.   Do yourself
a favour and get the latest Perl5  -  it has many more features than Perl4.
In particular, the suggestions of the other respondents (use 'my') are
only available in Perl5.

Happy Perling.

Mike Guy


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

Date: 7 Feb 1997 18:41:39 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: HELP NEEDED: pb with 'system'
Message-Id: <5dft13$otd@news-central.tiac.net>

In article <32FB58BA.17BA@aur.alcatel.com>,
Bruno Pagis  <pagib@aur.alcatel.com> wrote:
>The following command:
>	% remsh Hostname -l UserName ls
>works perfectly.
>
>When embedded in a Perl script:
>	#!/usr/local/bin/perl
>	@args=("remsh", "Hostname", "-l UserName", "ls");
>	system(@args);
>I raise the following error message: permission denied.

If you pass a list to system then it treats each element of the list as an
argument while constructing the argv array, so

  system ("remsh", "Hostname", "-l UserName", "ls")

ends up calling remsh with an argv of

  0 'remsh'
  1 'Hostname'
  2 '-l UserName'
  3 'ls'

I suspect you want to split it into

  system ('remsh', 'Hostname', '-l', 'UserName', 'ls');

Feeding system a list also avoids the possibility that /bin/sh -c is used
to interpret your command.

Hope this helps,

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: 7 Feb 1997 16:53:24 GMT
From: jimd@wogglebug.com (Jim Doubek)
Subject: Help: DBM on Perl Win32
Message-Id: <5dfmm4$8b7@news.scruz.net>

Hi,

I'm trying to get a script working on Perl 5 for Win32, build 110 using dbm. 
I have a short script which opens a db, adds one record, and closes it. It
works on Solaris 2.4 with perl 4.0. On NT Server 4.0, it exits on the line:

    $result = dbmopen(%ARY, 'testdb', 0666);

It seems to do something weird on line 463 of Dynaloader.pm which is:

    &{"${module}::bootstrap"}(@args);

(I traced thru to this point.) At that point it breaks back to the 
sdbm pm file, then seems to abruptly exit.

I'm doing all this in a sub, which I eval and then print $@. It completely
skips the exception stuff, and never prints.
I've checked my registry, and the PrivLib key is set correctly, and from
my understanding of the dynaload code, the DLL SDBM_File.pll is loaded 
by this time.

Any ideas?

- jim






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

Date: 7 Feb 1997 17:59:05 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: How to convert a text file of arbitrary length lines to fixed length?
Message-Id: <slrn5fmr6v.2ir.dave@fast.thomases.com>

On Fri, 7 Feb 1997 12:20:49 GMT, Jack Burton <jackb@pgw.picker.com> wrote:
> I'd like to know if anyone is willing to provide me an example perl
> script
> that does the following.
> 
> Given a text file that consists of lines of arbitrary length, convert it
> so
> that no line is longer than 80 characters and line breaks don't happen
> in
> the middle of a word (unless the word is itself greater than 80
> characters
> long).

Have you have a look at Text::Wrap on CPAN?

Dave


-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 7 Feb 1997 18:31:32 GMT
From: Tom Christiansen      		tchrist@perl.com <tchrist@mox.perl.com>
Subject: Re: How to peek at next line of STDIN? (repost)
Message-Id: <5dfse4$1j8$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Randal Schwartz <merlyn@stonehenge.com> writes:
:H> In other words I want to use the angle operator to read in a line and 
:H> then put that  line back so I can use the angle operator to read it in 
:H> again. How can this effect be achieved?

:It can't be done transparently

Sure it can: TIEHANDLE

--tom
-- 
Tom Christiansen      		tchrist@perl.com
                /* And you'll never guess what the dog had */
                /*   in its mouth... */
        --Larry Wall in stab.c from the v4.0 perl source code


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

Date: Fri, 07 Feb 1997 12:09:24 -0800
From: Vadim Parizher <Vadim.Parizher@jpl.nasa.gov>
Subject: Inserting \n inside the string
Message-Id: <32FB8BF4.41C67EA6@jpl.nasa.gov>

I have a very long perl-generated string separated by semicolons inside.

very:very:long:string

I need to insert a line break at about every 200 characters or less.  A
line break can only be inserted right after a semicolon.

Does anybody knows how to do it *efficiently*?

Thanks,

- Vadim


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

Date: 7 Feb 1997 16:55:29 GMT
From: dlee+@beijing.mt.cs.cmu.edu (Danny Lee)
Subject: Is there any module available for Chi-Square-distribution (at least 4 decimal places)?
Message-Id: <5dfmq1$cot@cantaloupe.srv.cs.cmu.edu>

I need to look up the probability given the Chi-Square statistics (degree of freedom = 1) to an accuracy 
of at least 4 significant figures/decimal places. Just wonder if someone has implemented such function/module in perl. 
Currently the module Statistics::ChiSquare from CPAN only provide answer with '2 significant figures'
using table look up. For higher accuracies, some other method other than table look up might be better.


Your help is greatly appreciated.

dlee@cs.cmu.edu


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

Date: 7 Feb 1997 16:20:48 -0000
From: aeb@calf.saltfarm.bt.co.uk (Tony Bass)
Subject: Re: Nice perl way to generate n! permutations for n=8 ??
Message-Id: <5dfkp0$1kq@calf.saltfarm.bt.co.uk>

>From article <E556D8.Eww@nonexistent.com>, by abigail@ny.fnx.com (Abigail):
> On 5 Feb 1997 00:51:54 GMT, NCPSLtd wrote in comp.lang.perl.misc:
> ++ I'm unable to come up with a nice "algorithm" to generate the permutations
> ++ for 12345678.  
> ++ 
> ++ Perl has always given me clever, compact ways to do such jobs, and I'm at
> ++ a loss for this one.


A perhaps over-compact rendering in functional style is

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

   sub perm {
    return (@_ <= 1) ? ([@_]) : map {
     my $i = $_;
     my $x = $_[$i];
     map { [$x, @$_]; } perm map { ($_ == $i) ? () : $_[$_]; } 0..$#_;
     } 0..$#_;
   }

   grep { print @$_, "\n"; } perm qw(a b c);

producing output

   abc
   acb
   bac
   bca
   cab
   cba

The (lexically) first map looks at each position in the input; the third
map delivers the input with this position removed, ready for the
recursive call; and the second map prefixes the selected element to each
sub-permutation.

It would probably be better style to begin the sub with my @v = @_, but
I was curious to see how short it could be made.

    Tony Bass

-- 
# Tony Bass                                     Tel: (01473) 645305
# MLB 3/19, BT Laboratories                     e-mail: aeb@saltfarm.bt.co.uk
# Martlesham Heath, Ipswich, Suffolk, IP5 7RE   DO NOT e-mail to From: line
#                                               Opinions are my own


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

Date: Fri, 07 Feb 1997 20:26:37 GMT
From: carsten@software.group.com (Carsten Schafer)
Subject: open() call under NT
Message-Id: <5dg35t$sko$1@nntp2.uunet.ca>


I am trying to open a file for reading (or writing) on a SCO Unix
hosted Samba Drive, but the open fails with "Invalid argument".

open(DADA, "H:\\db\\dada") || print $!;

If I copy the file to C: (a local hard drive) and execute

open(DADA, "C:\\db\\dada") || print $!;

the open succeeds.

I can also access the file with any other tool (edit, notepad, vi,
type etc.)

This is under perl 5.001 BTW.

Thank you for any help.




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

Date: 7 Feb 1997 15:23:02 GMT
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: Perl 5 package problems
Message-Id: <01bc150a$6d449a40$dabdaec7@cactus>

> The problem in a nutshell: I've created packages whose attributes and 
> methods can be accessed from within 'main' but not from within other
> packages, even though the variable containing the package reference
> is declared 'globally'.
> 
> It seems fairly obvious that the problems are all related to the package
> not being initialised/created/referenced properly, but I just can't
> figure out
> how or why!

>From the code you sent out I don't see where you ever create your Interface
object.  You need a line like this in your code:

	my $this = new Interface;

Then you can do this:

 	$this->html_get_header ($headings{$action});

You must create an Interface object in order to perform object oriented
things on it.

-- 
Geoff Mottram
minaret@sprynet.com


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

Date: Fri, 7 Feb 1997 10:14:08 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jonas Liljegren <jonas@cultcom.se>
Subject: Re: Perl 5.003 causes segmentation fault on SGI Irix
Message-Id: <Pine.GSO.3.95.970207101232.3726R-100000@linda.teleport.com>

On Thu, 6 Feb 1997, Jonas Liljegren wrote:

> The following program always cause a core dump: 

So, have you run perlbug to submit your bug report? It's easy to
do. 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: 7 Feb 1997 19:55:31 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Perl and Crontabs
Message-Id: <5dg1bj$ud@news-central.tiac.net>

In article <5dflrc$3e6@news3.digex.net>,
Bryan C. Liles <bliles@power.digex.net> wrote:
>
>This code snippet below works when I run it from the command line, but it
>doesn't work from cron.  Do I need to define something somewhere?
>

You might want to check where date lives on your system and check the
crontab or cron man pages for a paragraph or two like:

  The cron program invokes a subshell from your $HOME directory.  This means
  that it will not run your .profile file.  If you schedule a command to run
  when you are not logged in and you want to have commands in your .profile
  run, you must explicitly do so in the crontab file.  (For a more detailed
  discussion of how sh can be invoked, see the sh command.)

  The cron program supplies a default environment for every shell,  defining
  HOME, LOGNAME, SHELL (=/usr/bin/sh), and PATH (=:/usr/bin).

so explicitly setting %ENV or using full path names might help (as might
checking whether tho open worked or not...)

Hope this helps,

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: 7 Feb 1997 18:56:23 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: perl bug? side effect of using != where ne is required (semi-long)
Message-Id: <5dftsn$lhr@lyra.csx.cam.ac.uk>

John Klassa <klassa@ivc1.ivc.com> wrote:
>
>A co-worker came to me with some strange output he was seeing... We managed
>to figure out that the root of his problem was that he was using "!=" where
>he needed to be using "ne".

>From 'perlop' man page:

     Autoincrement and Autodecrement

     "++" and "--" work as in C.  That is, if placed before a
     variable, they increment or decrement the variable before
     returning the value, and if placed after, increment or
     decrement the variable after returning the value.

     The autoincrement operator has a little extra built-in magic
     to it.  If you increment a variable that is numeric, or that
>>>>>has ever been used in a numeric context, you get a normal
     increment.  If, however, the variable has only been used in
     string contexts since it was set, and  ...

So it's working as documented.   Pretty slippery, though.


Mike Guy


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

Date: 07 Feb 1997 19:17:56 GMT
From: earl@shadowfax.rchland.ibm.com (Joel Earl)
Subject: Re: perl bug? side effect of using != where ne is required
Message-Id: <EARL.97Feb7131756@shadowfax.rchland.ibm.com>

This is the expected behaviour of Perl. Doing a numeric comparison on a string
value is OK; perl just compares the numeric equivalent of the string, and
apparently considers that value to be a number from then on. A comparison
never actually alters the comparands, though, which I think everyone agrees is
a desirable behavior! It's not until you alter a value with a numeric
operation that perl has the opportunity to take liberties such as discarding
leading zeros.

If you do a string comparison instead of a numeric comparison, then $idx is
not "marked" as a number. Then when it's time to do the autoincrement, perl
assumes that you want the magic string autoincrement, which will give you a
sequence like "000", "001", "002". If you had used "$idx += 1" instead of
"$idx++", then you would have gotten a numeric sequence regardless of the type
of comparison.
-- 

   Joel Earl, earl@vnet.ibm.com
   Logic Analysis and Optimization
   IBM Rochester, Minnesota
   (507) 253-2304


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

Date: 07 Feb 1997 19:29:06 +0100
From: terry jones <terry@teclata.es>
Subject: perl HTTP proxy?
Message-Id: <scn2tgjwr1.fsf@teclata.es>


Is there source available somewhere for a simple perl HTTP proxy? I'd
be happy with any bare bones implementation, I just want to fiddle
with what my browser sends and receives (cookies, images etc.) in the
manner of WebFilter (http://www.math.ucsb.edu/~boldt/NoShit/) etc.

I've had a look at a few HTTP proxies, but haven't seen anything in
perl. It would be useful if someone produced a do-nothing perl HTTP
proxy for others to use as a base for future implementations. It
should allow chaining to other proxies etc. If I can't find anything
and I do it myself, I'll post it....


Thanks for any pointers,

Terry "Not a Spammer" Jones (terry@teclata.es).


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

Date: Fri, 7 Feb 1997 18:17:13 GMT
From: abigail@ny.fnx.com (Abigail)
Subject: Re: Perl vs Korn Shell
Message-Id: <E58w4p.79y@nonexistent.com>

On Fri, 07 Feb 1997 10:27:33 -0600, Dave Stagner wrote in comp.lang.perl.misc:
++ Whether perl or korn shell is better depends largely on what you're
++ doing.  Korn shell is much more effective as an interactive command line
++ than perl.  :}
++ 
++ As a programming language, perl is far, far more powerful than Korn
++ shell or any other Unix shell.  For that matter C++ is (arguably) more
++ powerful than perl.  That doesn't mean you should use C++ for everything
++ that can be done in perl, right?  Nor should you use perl for everything
++ that can be done in a Unix shell.  Quickie shell programming, especially
++ simple loops and stuff on the command line, can be very powerful and
++ useful. 
++ 
++ Like someone else said, a good hacker should learn BOTH shell and perl.
++ And C, and maybe Lisp.  Not sed or awk, because perl is much better. :}


I agree perl is "better" than sed or awk. Yet I still use awk for
two reasons:

- Sometimes awk is less typing (or less thinking) than perl.
  I just can't beat "| awk '{print $2}'" in perl.
- Political reasons. I write little tools that can be used by
  our people at clients sites. Usually, those clients don't have
  perl installed. And I can't convince high enough people here
  that it is worth while to convince our customers to install
  (or have us) install perl. (And yes, this has to do with the
  fact awk/sh comes with a SunOS/Solaris install and perl doesn't.)



Abigail



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

Date: 07 Feb 1997 14:38:41 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: Perl vs Korn Shell
Message-Id: <bu9wieym.fsf@jander.com>

kinge@oklahoma.net (Ed King) writes:

> I'm at the point where I want to write some simple programs for my
> private use.  I bought the Bolsky book entitled "The New Korn Shell" and
> the author maintains the Korn shell is the greatest thing since sliced
> bread.  I want to know if Korn shell scripting or Perl is more
> versatile.  If I just want to invest time learning one which one should
> it be and why.

There are 2 answers to your question. You can get the first one here,
and the other by posting to comp.unix.shell :)

But it's quite unlikely that _anyone_ who is conversant with both
would answer "Korn Shell".

-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: Fri, 7 Feb 1997 12:05:27 -0800
From: Ian Stanislaw Wojtowicz <iswojtow@sfu.ca>
Subject: PERL/NT4.0/IIS2.0 bugs?
Message-Id: <Pine.SGI.3.91.970207120137.441B-100000@beaufort>

Hi. Does anyone know of any Perl bugs related to upgrading from Windows NT 3 
to 4, or from Microsoft IIS 1.0 to 2.0? Some of our scripts have been 
misbehaving and I'm having a tough time finding the cause.

Please reply to ian@knowarch.com. Thanks.

ian


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

Date: Fri, 7 Feb 1997 11:08:34 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "E." <erisson@kallisti.sw-tech.com>
Subject: Re: print 'undef' in an elegant way ?
Message-Id: <Pine.GSO.3.95.970207110526.3726a-100000@linda.teleport.com>

On 6 Feb 1997, E. wrote:

> print ($value || "undef");

Ouch! That method prints "undef" if $value is undefined, sure, but it also
does so if $value is 0, "", or "0". I don't think that that is generally
desirable.

-- 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: Fri, 7 Feb 1997 19:21:00 GMT
From: ceetm@cee.hw.ac.uk (Triantafyllos Marakis)
Subject: Problem with call of system
Message-Id: <E58z31.G6n@cee.hw.ac.uk>

Can anyone help me with this problem?

    I am trying to run a script from a Web page. While it works when
    I use C-shell, when I run it from the Web page a Web server error 
    occurs.

    The command that I used is system "webget 'http://the_name_of_page'".
    Webget is a program that downloads the file specified by the name
    of the page.

Thanks.
--
TRIANTAFYLLOS MARAKIS     |Email:ceetm@cee.hw.ac.uk
BSc in Computer Science IV|Web  :http://www.cee.hw.ac.uk/~ceetm
HERIOT-WATT University    |George Burnett Hall(2.54), Heriot-Watt Univ.,
Edinburgh, Scotland       |Edinburgh,EH14 4AS, Scotland UK




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

Date: 7 Feb 1997 18:31:03 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: regexps challenge - movies.txt (0/1)
Message-Id: <slrn5fmt2s.2ir.dave@fast.thomases.com>

On Thu, 06 Feb 1997 20:50:57 GMT, Helen <forr@ultranet.ca> wrote:
> I wish to pull the url's, links, and descripive text out of an html
> page and place them in a colon delimited text file; like so:
> 
> www.byte.com:Byte Magazine:Cross-platform computer magazine:0
> (the 0 needs to be on the end for later programming)

You might try something like:

#!/usr/bin/perl -w

undef $/;
$_ = <>;              # slurp whole file
s/\n/ /mg;            # get rid of newlines

$pattern = 'http://(.+?)"?>\s*(.*?)</A>\s*(.*?)\s*<';

while (m/$pattern/g) {
   print "$1:$2:$3:0\n";
}

__END__

However, beware some nested markups!

Dave

-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Fri, 7 Feb 1997 18:38:06 GMT
From: abigail@ny.fnx.com (Abigail)
Subject: Re: regexps challenge - movies.txt (0/1)
Message-Id: <E58x3I.9Hr@nonexistent.com>

On Thu, 06 Feb 1997 20:50:57 GMT, Helen wrote in comp.lang.perl.misc:
++ I wish to pull the url's, links, and descripive text out of an html
++ page and place them in a colon delimited text file; like so:
++ 
++ www.byte.com:Byte Magazine:Cross-platform computer magazine:0
++ (the 0 needs to be on the end for later programming)
++ 
++ The code below will take out url's and their ensuing links, giving me
++ the following table:
++ www.byte.com:Byte Magazine: :0
++ 
++ But  ff I try to take out the descriptive text as well, I get nothing.
++ 
++ Any suggestion as to why this is happening would be greatly
++ appreciated.
++ 
++ I've attached the html document I'm trying to get this to work on.
++ 
++ __________________________________________________
++ 
++ #!/usr/bin/perl -w
++ 
++ #match url's     
++ $url = "http:\/\/(.+?)(?=\">)";                 
++ 
++ #match links between url and </a>
++ $link = "\">(.+?)(?=<\/a>)";
++  
++ #match descriptive text between</a> and next markup
++ #This one doesn't work!
++ $descr = "<\/a>\b(.*?)<";
                  ^
                  You want the \b to appear in your regex. However, 
                  "" does variable substitution. This includes any
                  \ processing. You are escaping the b from appearing
                  special to "". What you need is to escape the \
                  itself. Use one of:

$descr = "</a>\\b(.*?)<";
$descr = '</a>\b(.*?)<';

And note that there is no reason to escape the /.

++ 
++ # $/ ="";   
++ while (<>) {
++    # pull url's, links, and descriptions out of markup text
++    if (/$url$link/gis) {
++     
++    #put matches in : delimited list; add 0
++    @flatline = join ':', $1, $2, $3, '0';
++    print (@flatline, "\n");
++    }
++ }

You can write this as:
$, = ":"; $\ = "\n";
while (<>) {print $1, $2, $3, 0 if /$url$link/gis;}


Putting the result of a join into a list is kind of odd,
as it returns a scalar. (Or does join have some magical
effects in a list context?)




Abigail



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

Date: Fri, 7 Feb 1997 17:54:40 GMT
From: rl3s@netcom.com (Zeus Paleologos)
Subject: SIGPIPE in server script - where's the pipe?
Message-Id: <rl3sE58v35.A06@netcom.com>


I wrote a server in Perl that appears to intermitently fail with 
a SIGPIPE.  Sometimes it fails after 100+ successful transactions 
and sometimes after as few as 4.  I don't explicitly set up a pipe 
in the script or when I run it.  So where's the pipe that is failing?
If I provide a handler for the SIGPIPE, what does it need to do?
How can I get a handle :) on this problem?

(BTW, the script is part of a proprietary package so I can't provide 
a code example here but I can say that the socket programming {socket,
bind, listen, forever{ accept, read, print, close}} is nothing fancy 
and is essentially the same as that illustrated in the Camel book
examples.)

TIA for any help.



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

Date: 7 Feb 1997 18:55:33 GMT
From: kirel@earth.execpc.com (Joe Schulte)
Subject: Simple simple question
Message-Id: <5dftr5$62u@newsops.execpc.com>

Okay, this is bugging the hell out of me, and it really shouldn't be that
hard. Problem is, neither of the books I have tells me how to do it...

I'm reading a number from a file. Only thing in the file is that number.
No problem. Except when I use 'chop' to read it, it becomes a string. I
want to now manipulate this as a number. How? The command must exist -
hell, even AppleBASIC had the val()_ command.

So, how do I convert a number to a string and vice versa?

Any help would be appreciated.



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

Date: 7 Feb 1997 20:01:49 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Simple simple question
Message-Id: <5dg1nd$1dr@news-central.tiac.net>

In article <5dftr5$62u@newsops.execpc.com>,
Joe Schulte <kirel@earth.execpc.com> wrote:
>Okay, this is bugging the hell out of me, and it really shouldn't be that
>hard. Problem is, neither of the books I have tells me how to do it...
>
>I'm reading a number from a file. Only thing in the file is that number.
>No problem. Except when I use 'chop' to read it, it becomes a string. I
>want to now manipulate this as a number. How? The command must exist -
>hell, even AppleBASIC had the val()_ command.
>
>So, how do I convert a number to a string and vice versa?

Perl keeps a track of the last context a scalar was used in (string vs
numeric) but in general you just use the variable.  If you want to force
it into a numeric representation then you can add 0 e.g.

  $var = '00001000';
  $var += 0;

now printing $var will give 1000 rather than 00001000

Converting to a string may involve the use of sprintf depending on how you
want the variable to be represented.

Usually in perl you can just let things take care of themselves e.g.

  $var = "100\n";
  chomp $var;
  $var += 6.5;

is quite reasonable...

Hope this helps,

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: 7 Feb 1997 19:57:22 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Simple simple question
Message-Id: <5dg1f2$sg4@fridge-nf0.shore.net>

Joe Schulte (kirel@earth.execpc.com) wrote:
: Okay, this is bugging the hell out of me, and it really shouldn't be that
: hard. Problem is, neither of the books I have tells me how to do it...

Take a look at the following code, which might answer your question.

#!/usr/local/bin/perl -w

$value = '' unless $value; ### mollify perl -w
$file = '/nfic/users/nvp/Perl/File/counter.fil';

open(FILE, "+<$file")
    || die("No: $!\n");
chop($value = <FILE>);
print("You are visitor number: $value\n");
seek FILE,0,0;
print FILE $value+=1,"\n";
close(FILE);

--
Nathan V. Patwardhan
nvp@shore.net
"What is your quest?"


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

Date: 7 Feb 97 11:47:57 +0100 (CET)
From: pcarty@eurokom.ie
Subject: Socket questions Win32
Message-Id: <1997Feb7.114757.15737@vms.eurokom.ie>


Hi,
I've written a simple telnet under Win95. I have a basic version
working but I'd like to bullet proof it a bit.
Here is a sample interaction:

send(S, "dir\r",0);       # Get directory of Alpha                    
while($bigbuf !~/\$ /) {              # While the $ prompt not received.
        recv( S, $tempbuf, 100, 0 );
        $bigbuf .= $tempbuf;          # Add little buf to big buf.
}

The above is very dependent on receiving the $ prompt after the remote
command terminates.
If it doesn't arrive recv() will wait until Alpha times out - 6 mins.
Can anybody suggest a way of timing out the recv() ? 
Most code I've seen uses alarm() or select() which aren't supported on Win32

How can I detect if the connection is lost like I pull the ethernet cable?
I've tried using while(S) but it didn't leave the loop when I broke the
connection.
recv() always returns undef when I test it. 

Is it possible to check the status of the socket before doing a recv() ?
That is to check that there is actually data waiting.

Any help much appreciated.

Peter.


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

Date: 7 Feb 1997 19:29:56 GMT
From: pmagaf@aol.com (Pmagaf)
Subject: Technical Producer Needed--San Francisco
Message-Id: <19970207192900.OAA06616@ladder01.news.aol.com>

Technical Producer
PARENTING Online

Sex. Babies. Feverish nights. Daytime dramas. Cyberspace doesn't get any
more real than this! 

PARENTING Online, a project of PARENTING magazine and Time Inc.'s New
Media division, is looking for a full-time Technical Producer for sites on
America Online and the World Wide Web.

SPECIFIC RESPONSIBILITIES:

* Work on a team that's building dynamic sites on AOL (keyword
Thrive@Health) and Time Warner's Pathfinder Web site
(http://www.parenttime.com).
Tasks include scripting content in HTML and Rainman, posting articles,
continually updating the sites, as well as assisting in Web design, site
maintenance, and fun application development.

* Fine-tune the production process by keeping abreast of technical
advances in new media.

* Troubleshoot technical problems.

REQUIRED SKILLS AND EXPERIENCE:

* Must be detail-oriented and have excellent communication skills, as well
as be able to set priorities, juggle many projects, and maintain a good
sense of humor at all times.

* Must be a self-starter and an adept problem-solver who is able to work
with limited supervision and as part of a team.

* Must be willing and able to learn new production and technical skills on
the fly.

* Must have experience building a WWW site.

* Must have experience writing cgi scripts (Perl, C++).

* Knowledge of: 

Hardware: Macs, PCs, and Web servers.

Software: HTML 3.0, Netscape 3.0, HTML editors, QuarkXPress,
Photoshop,Illustrator, FileMaker, Fetch, Telnet, and form-scripting and
image-mapping tools.

* The ideal candidate will also be familiar with AOL's Rainman markup
language, UNIX, vi editor, and have experience with web
interface-to-database programs, although those skills aren't required.

COMPETITIVE SALARY AND BENEFITS 

Send resumes to: 

Rachael Grossman
New Media Editor
Parenting Magazine
Embarcardero Center #2, Sixth Floor
San Francisco, CA 94111
e-mail: javalu@aol.com



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

Date: 7 Feb 1997 20:15:26 GMT
From: softbase@mercury.interpath.com (Scott McMahan - Softbase Systems)
Subject: Re: Windows 95 File Commands
Message-Id: <5dg2gu$n6c@redstone.interpath.net>

James Eberhardt (jamese@interlog.com) wrote:
: I am trying to use the following code to open and read a file:

: 	open (FILE, "testperl.txt") || die print "\nCannot open\n";

: When I try and open this file I get "Cannot open"

"die print" is an unusual construction and can't be what
you really mean. You either want to die with a message, or print
a message. 

What you wrote is syntactically valid, and the print seems to be
an argument to die, but I'm not sure how the precedence would
work here.  The || may be binding like this:

 	( open (FILE, "testperl.txt") || die ) print "\nCannot open\n";

In which case the print would execute if successful. I don't know --
neither print nor die are function calls, so there's no telling where
they lie in the precedence food chain. Use parens and you never
have to wonder.

I think making the expression better would help clear things up.

Scott




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

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 V7 Issue 912
*************************************

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