[9649] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3243 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 24 10:18:41 1998

Date: Fri, 24 Jul 98 07:00:27 -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           Fri, 24 Jul 1998     Volume: 8 Number: 3243

Today's topics:
    Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Pos <TerryLCora@worldnet.att.net>
    Re: changing default shell for system() <nguyend7@egr.msu.edu>
    Re: Code showing apparent "Perl While Bug" (Juergen Heinzl)
    Re: Code showing apparent "Perl While Bug" <quednauf@nortel.co.uk>
    Re: Copyright question <jdporter@min.net>
    Re: future date in epoch time <chris.wareham@blackwell.co.uk>
    Re: How to access modem on NT ( terminal and ppp ). <xiong@bigfoot.com>
    Re: How to know the number of hash items without runnin (Mike Stok)
    Re: modifying a text file <rick.delaney@shaw.wave.ca>
    Re: MsDev Automation with Perl scott@softbase.com
    Re: newbie Q2: do 'script.pl?parm1=xxxx'; <joe@halbrook.com>
    Re: parsing question <minich@globalnet.co.uk>
    Re: perl as pseudocode (Mike Stok)
    Re: Perl Beautifier Home Page (Georg Bauer)
    Re: Perl Beautifier Home Page (Snowhare)
        perlfaq <gpsingh@mailcity.com>
        pingecho <kamrani@ifi.uio.no>
        seek file <gpsingh@mailcity.com>
    Re: Server Side Includes <tonylabb@infonline.net>
    Re: Slash vs backslash in nt vs 95? scott@softbase.com
        spss file format <u7srmw@csc.liv.ac.uk>
        Text processing question <ewilliams@wesleyan.edu>
    Re: updating binary file <rick.delaney@shaw.wave.ca>
    Re: using s/// (Mike Stok)
        Why can't I "require" a file? <david@system-concepts.com>
    Re: Why can't I "require" a file? <quednauf@nortel.co.uk>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Fri, 24 Jul 1998 08:19:02 -0400
From: "Terry Cora" <TerryLCora@worldnet.att.net>
Subject: Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Posted Twice Weekly ***
Message-Id: <6p9u3d$3ha@bgtnsc03.worldnet.att.net>

>Am I the only one who thinks that this post is not appropriate ?
>
>Birgitt Funk


I doubt it.

But I was supprised that the mini-FAQ only contained 1 book reccomendation
with a link to their commercial website - O'Reilly press.  There are many
other books that may be of interest to those who visit this newsgroup and
not all are by O'Reilly.  I checked a little further and found out that
Nathan Torkington, Perl mini-FAQ maintainer is an author who's book, "The
Perl Cookbook" is being published by O'Reilly, available August, '98 $39.95.

Terry Cora

>> >-Nathan Torkington, Perl mini-FAQ maintainer
>> >--
>>
>>
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




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

Date: 24 Jul 1998 12:24:35 GMT
From: Dan Nguyen <nguyend7@egr.msu.edu>
Subject: Re: changing default shell for system()
Message-Id: <6p9ue3$8ke$1@msunews.cl.msu.edu>

Alexandros Labrinidis <labrinid@cs.umd.edu> wrote:
: Hello all.

:  I'd like to change the shell that system() spawns to execute its
: arguments. For some reason, although $ENV{'SHELL'} is tcsh, perl
: sticks with sh for system(). Any ideas? 

Well the reason Alex is this.  Bourne Shell (sh) is on every UNIX
system.  That you can guarantee.  This like CShell and tcshel are
optional.


-- 
Dan Nguyen                         |
nguyend7@cse.msu.edu               |   I am Grey.
http://www.cps.msu.edu/~nguyend7   |   



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

Date: 24 Jul 1998 11:51:00 GMT
From: juergen@lth330dn.sbs.de (Juergen Heinzl)
Subject: Re: Code showing apparent "Perl While Bug"
Message-Id: <slrn6rgtfg.l9l.juergen@lth330dn.sbs.de>

In article <35B86AEF.167E@webleicester.co.uk>, Mark Simonetti wrote:
>Try this with perl (latest version)..
>It should display "Woohoo" twice right ?
If I am not wrong ... wrong ... look ...
each - retrieve the next key/value pair from a hash 
       -----------------

 ... and here ... 

my $hash = {};

$$hash{'test1'} = 'value1';
$$hash{'test2'} = 'value2';

($a,$b) = each(%{$hash});
print "\$a: $a ... \$b: $b\n";

($a,$b) = each(%{$hash});
print "\$a: $a ... \$b: $b\n";

 ... and this does more or less the same as ...

>#!/usr/local/bin/perl -w
># Proggy to show while bug
>
>my $hash = {};
>
>$$hash{'test1'} = 'pants';
>$$hash{'test2'} = 'wibble';
>$$hash{'test3'} = 'wobble';
>
>&test($hash, 'wibble');
>&test($hash, 'pants');
>
>sub test {
>  my($donkey, $srch) = @_;
>  my($prm1, $prm2);
>
>  while(($prm1, $prm2) = each(%$donkey)) {
>    if($prm2 eq $srch) {
>      print "Woohoo !\n";
>      return(1);
>    }
>  }
>
>  print "ahh pants !\n";
>}
 ... since the first call to test() will retrieve 'test1'/pants and
'test2'/wibble and the second call then 'test3'/wobble. Say, just
unroll the loop ... would you expect a different behaviour then ?

Bye, J|rgen

-- 
\ Real name	  : J|rgen Heinzl     \
 \ Email (office ) : idoinet@sbs.de    \
  \ Email (private) : unicorn@noris.de  \
   \ Phone (private) : +49 911-4501186   \


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

Date: Fri, 24 Jul 1998 13:00:23 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Code showing apparent "Perl While Bug"
Message-Id: <35B87757.A6F55C4D@nortel.co.uk>

Mark Simonetti wrote:
> 
> Try this with perl (latest version)..
> It should display "Woohoo" twice right ?

I don't know. I built in a few print statements, and apparently the
while statement works as I've learned to expect it from something like
while (<DATA>) { ...

If this construct brings me to line 18 of a file, and I call while
again, then it will still be there, waiting to read line 19.

If you build in a few print statement to see what $prm1, $prm2, you will
see that the same seems to happen here. The first time you call test it
hits 'wibble' and drops out. The second time it is still at the same
point, ready to read in the next argument, which will be 'wobble' in
your program. I don't think that this is a bug, but I suppose that there
is some while internal counter that only becomes reset when the whole
construct to go through with while has been passed. You can see that
when you take out the return statement. The while loop is gone through
completely, seems to be reset at this point, and at the second call of
test goes through the whole hash again.

However, my initial comparison with the filehandle doesn't work in the
same way. That is why it's a bad comparison! If you while(<a_file>), and
it finally drops out, a subsequent call of while won't reset anything.
Some other internals seem to be working there.
--------------------
my $hash = {};

$$hash{'test1'} = 'pants';
$$hash{'test2'} = 'wibble';
$$hash{'test3'} = 'wobble';

&test($hash, 'wibble');
print "Ready to go for seconds..\n";
&test($hash, 'pants');

sub test {
  my($donkey, $srch) = @_;
  my($prm1, $prm2);

  while(($prm1, $prm2) = each(%$donkey)) {
   print  $prm1, $prm2,"\n";
   if($prm2 eq $srch) {
      print "Woohoo !\n";
      return(1);
    }
  }

  print "ahh pants !\n";
}


-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Fri, 24 Jul 1998 13:54:58 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Copyright question
Message-Id: <35B893BE.6F75@min.net>

Dustin Cobb wrote:
> 
> I'm a cgi programmer and I've written many scripts for the ISP I work
> for.  Recently, I've been told by someone else in our company that the
> scripts that we've written in Perl cannot be copyrighted due to the fact
> that Perl isn't a compiled language.  

Heh, I think MicroSoft would quite surpised (i.e. amused) to hear this.
Just have your company's lawyers contact MicroSoft's lawyers;
they're hear a whole 'nother story, and you can rest easy.

-- 
John Porter


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

Date: Fri, 24 Jul 1998 13:24:20 GMT
From: Chris Wareham <chris.wareham@blackwell.co.uk>
Subject: Re: future date in epoch time
Message-Id: <35B88B9E.D927BD81@blackwell.co.uk>

sjborden@my-dejanews.com wrote:
> 
> Does anyone  have any ideas how to take a future date (i.e. 12/31/98) and
> convert it to epoch time?
> 

This should do it (note the month range is 0 - 11):

  #!/usr/bin/perl -w

  use strict;
  use Time::Local;

  my %date = (
      day   => '31',
      month => '11',
      year  => '1998'
  );

  my $time = timelocal(0, 0, 0, $date{day}, $date{month}, $date{year});
  print "Seconds since epoch = $time\n";

Chris
-- 
chris.wareham@blackwell.co.uk
+44 (0)1865 792792 ext. 3381
http://www.killingmiranda.pair.com/


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

Date: Fri, 24 Jul 1998 12:26:19 GMT
From: Meng Xiong <xiong@bigfoot.com>
Subject: Re: How to access modem on NT ( terminal and ppp ).
Message-Id: <35B87E9C.FA1F5F7E@bigfoot.com>

Andrew M. Langmead wrote:

> Meng Xiong <xiong@bigfoot.com> writes:
>
> >Is there a module that I can use to establish a ppp connection and a
> >direct dial in connection on Windows NT? Thanks for the help.
>
> Microsoft has a Knowledge Base article on who to start up DUN (Dial Up
>
> Networking) from the command line in Windows 95
>
> <URL:http://support.microsoft.com/support/kb/articles/q145/7/40.asp>
>
> can you do something similar in NT?
>
> --
> Andrew Langmead

Thanks for the pointer. It does not work in NT. The command line given
in the article is
  rundll rnaui.dll,RnaDial My Connection
But I could not find either rundll.* or rnaui.* in NT. Maybe there is
something similar, I don't know.

I would also like to dail up to a BBS. Any help is appreciated.

--
7220 Mccallum Blvd. #1302                   (972) 380-6028 (home)
Dallas, TX 75252                            (972) 685-8268 (office)




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

Date: 24 Jul 1998 12:14:59 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: How to know the number of hash items without running loop.
Message-Id: <6p9ts3$s6f@news-central.tiac.net>

In article <6p8an0$76d$1@rand.dimensional.com>,
Daniel Grisinger  <dgris@rand.dimensional.com> wrote:

>More correctly, the above approach should be-
>     $numitems = $#hkeys + 1 - $[;
>This will correct for the situation of $[ being a value
>other than 0.

Why not just

  $numitems = @hkeys;

?

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: Fri, 24 Jul 1998 12:23:26 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: modifying a text file
Message-Id: <35B87E1E.CD8DE3D9@shaw.wave.ca>

Bob Shair (courtesy) wrote:
> 
> Many thanks for your suggestion.  In perlfaq5 I find an example which
> does exactly what I need, and believed was not possible.
> It updates one of the early records in a large file without reading
> the entire file, much less needing to store two copies at once.
> 
> In my environment, large files are running about 3GB, so the fewer
> times we need to pass them, the better!
> 
> This is the code, from perlfaq5, which works for me:
> #!/usr/local/bin/perl
> $RECSIZE = 205; # size of record, in bytes
> $recno   = 3;  # which record to update
> open(FH, "+<testfile") || die "can't update testfile: $!";
> seek(FH, $recno * $RECSIZE, 0);
> read(FH, $record, $RECSIZE) == $RECSIZE 
>                            || die "can't read record $recno: $!";
> # munge the record
> substr($record,0,16) = "Kilroy was here!";

Watch out that the string on the right hand side is not greater than the
substring you're assigning to or you will overwrite more than one
record.

    substr($record,0,16) = 
         sprintf "%-.16s", "Kilroy was here!  Truncate this part";

> seek(FH, $recno * $RECSIZE, 0);
> print FH $record;
> close FH;


-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: 24 Jul 1998 12:44:18 GMT
From: scott@softbase.com
Subject: Re: MsDev Automation with Perl
Message-Id: <35b881a2.0@news.new-era.net>

eoloughlin@my-dejanews.com wrote:

> It would be too error prone to request that people always keep the
> active project set to the 'main' project in the workspace so what
> I want to do is to set the active project through OLE before doing
> the Build/RebuildAll() step.

The low-tech solution: Create a master project that's separate from the
ones people build in their day-to-day programming that's a copy of the
normal project, and build *it* automatically.

Frankly, I think it's amazing if you can get *anything* to work as
poorly documented as the Automation interface for DevStudio is! It took
me weeks just to figure out how to get a project to build. I have
a suspicion that no one has ever actually used the Automation
interface, and it has never been tested.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: Fri, 24 Jul 1998 07:35:48 -0500
From: Joe Halbrook <joe@halbrook.com>
Subject: Re: newbie Q2: do 'script.pl?parm1=xxxx';
Message-Id: <35B87FA4.2E4B@halbrook.com>

Joe Halbrook wrote:
> 
> I need to call another script using "do 'xxx.pl';" only passing parms.
> Any ideas?


Well, I tried just sending a Location: header using the syntax:

print "Location:
http://.../cgi-bin/script.pl?parm1=value&parm2=value\n\n";

The redirect definitely works, but the receiving script isn't picking up
the parameters.  So here I sit!

Any ideas?


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

Date: Fri, 24 Jul 1998 13:26:53 +0100
From: "Martin" <minich@globalnet.co.uk>
Subject: Re: parsing question
Message-Id: <6p9ujl$n84$1@heliodor.xara.net>

Eek, I hang my head in shame never to Perl again <g>

Martin




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

Date: 24 Jul 1998 12:39:30 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: perl as pseudocode
Message-Id: <6p9va2$t3e@news-central.tiac.net>

In article <2849.508T227T13862392@mistral.co.uk>,
Adam Atkinson <ghira@mistral.co.uk> wrote:
>I occasionally have to give shortish talks to colleagues in which
>I explain how to do something (e.g. Huffman coding or Monte carlo
>simulation) and as well as explaining the algorithm I will show a program
>in perl which actually DOES the thing in question.

>I've read FAQs and books, and this sort of issue doesn't seem
>to be covered anywhere. I realise it's hard to say anything useful
>about - what DO we assume the audience can understand? I'd say
>"not regular expressions", but maybe in some unix environments
>this would be unreasonable.

>As an example, here is a program I have really used as part of a talk.

One thing you might consider is using whitespace and indentation to make
the structure of the code more clear, in perl 5 distributions there's a
perlstyle man page (you can say perldoc perlstyle to see it too) which
suggests some coding guidelines.

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


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

Date: Fri, 24 Jul 1998 11:33:55 GMT
From: gb@hugo.westfalen.de (Georg Bauer)
Subject: Re: Perl Beautifier Home Page
Message-Id: <gb-2407981333550001@jill.westfalen.de>

In article <6yUeA4qXw-B@khms.westfalen.de>,
kaih=6yUeA4qXw-B@khms.westfalen.de (Kai Henningsen) wrote:

>But that's obviously not how it works. Perl-the-implementation _can_ have  
>bugs. Ergo, you're wrong.

Jupp. There is a difference between a definition of a language and an
implementation. Perl is defined by more than just the single
implementation that's around. Things like common usage and expected
results come to mind.

bye, Georg

-- 
"Sicher ist, das nichts sicher ist. Aber selbst das nicht."
 - Ringelnatz


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

Date: 24 Jul 1998 07:57:29 -0600
From: snowhare@xmission.xmission.com (Snowhare)
Subject: Re: Perl Beautifier Home Page
Message-Id: <6pa3s9$320$1@xmission.xmission.com>



Nothing above this line is part of the signed message.

In article <6p90pm$qta$1@news.campus.mci.net>,
Kenneth Herron <kherron@campus.mci.net> wrote:
>As I said elsewhere in the thread, I tend to split code out into a
>separate routine if I find myself indenting too much (not the *only*
>reason, of course :-).  Given the original code, a logical split would
>be to separate the code that handles looping through dates from the
>code that processes each candi-date.
>
>That would still leave some fairly messy code to handle looping through
>a range of dates.  The following probably isn't an exact
>replacement--it may have a fencepost error relative to the original
>code, for example--but gives the flavor of an alternate method.  As
>someone else suggested, this converts the dates to seconds since the
>epoch--days since a common starting date could have been used, if the
>application needed to handle a wider range of dates--and loops forward
>one day at a time.  A separate variable tracks day-of-week to avoid
>having to call gmtime() each time through the loop.

[...]

The code fails in two ways: one obvious - the other subtle.

The obvious failure is that you can only generate dates in the range of
1970-2038 on most machines because gmtime is only defined over that range
on most machines (trying work around it with epoch shifting won't help
beyond 1901 to 2099 because of the 100 year leap year rule and its
intersection with the 400 year rule). The subtle failure is that it
doesn't account for 'leap seconds' - this means that (at least in theory
and only if your OS is smart enough to include documented leap seconds) it
will 'slip' everytime it crosses a leap second boundary. Depending on the
location of the recurrance, this can ripple up through the date until it
does something like generate '199712312359' when it should have generated
'199801010000'.

If you aren't aware of what a leap second is, it is an extra second
inserted (or deleted, in theory at least) on an irregular basis to account
for the fact the earth does not rotate perfectly smoothly. From the US
Naval Observatory, here is a list of Leap Seconds:

# Leap  YEAR    MONTH   DAY     HH:MM:SS        CORR    R/S
Leap    1972    Jun     30      23:59:60        +       S
Leap    1972    Dec     31      23:59:60        +       S
Leap    1973    Dec     31      23:59:60        +       S
Leap    1974    Dec     31      23:59:60        +       S
Leap    1975    Dec     31      23:59:60        +       S
Leap    1976    Dec     31      23:59:60        +       S
Leap    1977    Dec     31      23:59:60        +       S
Leap    1978    Dec     31      23:59:60        +       S
Leap    1979    Dec     31      23:59:60        +       S
Leap    1981    Jun     30      23:59:60        +       S
Leap    1982    Jun     30      23:59:60        +       S
Leap    1983    Jun     30      23:59:60        +       S
Leap    1985    Jun     30      23:59:60        +       S
Leap    1987    Dec     31      23:59:60        +       S
Leap    1989    Dec     31      23:59:60        +       S
Leap    1990    Dec     31      23:59:60        +       S
Leap    1992    Jun     30      23:59:60        +       S
Leap    1993    Jun     30      23:59:60        +       S
Leap    1994    Jun     30      23:59:60        +       S
Leap    1995    Dec     31      23:59:60        +       S
Leap    1997    Jun     30      23:59:60        +       S

As you can see, the slippage is nearly 1/2 minute from 1972 to 1997. Leap
seconds aren't a problem in the original code because it doesn't depend on
the absolute interval. :) 

Benjamin Franz


Version: 2.6.2

iQCVAwUBNbiSxOjpikN3V52xAQHOfwP/YDpDjMQUIDBPkDELsyd00Tzx97VQRbox
opYr6q8Wpeqjc71V5v4tA/ory+ZLp7wUwMnFih2+uestdR2bIclioVojcQ2mvBjK
/dhkrIcRFGah3Ab6A4bHPe6NMhQcjgsVDND0afQhoKaDc50d3jV/IbmJomtAseZN
O3jud46MgHw=
=fI2W
-----END PGP SIGNATURE-----


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

Date: Fri, 24 Jul 1998 09:47:11 -0400
From: "gpsingh@mailcity.com" <gpsingh@mailcity.com>
Subject: perlfaq
Message-Id: <35B8905F.A7B7F44C@mailcity.com>

Hey,
Where can i get perlfaq4/5 , perldoc information.
Thanks
GP
PS: Please respond at gsingh@exodus.net



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

Date: Fri, 24 Jul 1998 15:55:17 +0200
From: Kamran Iranpour <kamrani@ifi.uio.no>
Subject: pingecho
Message-Id: <35B89245.4809@ifi.uio.no>

Hi

I have a problem with pingecho.
Why is pingecho reporting that the host is not responding
but at the same time I can rlogin into the same host ?

Kamran


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

Date: Fri, 24 Jul 1998 09:44:02 -0400
From: "gpsingh@mailcity.com" <gpsingh@mailcity.com>
Subject: seek file
Message-Id: <35B88FA1.4B3CC3D2@mailcity.com>

Hi,,
I want to open a file , reach the file at a particular pattern and then
do manipulation on the file from there on.
For example i want to open a log file, reach today's date ,forget about
the data before the date and then work on the lines after that date.
How to do that?

TIA
GP
PS : Please respond me at gsingh@exodus.net



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

Date: Fri, 24 Jul 1998 08:42:24 -0400
From: Tony Labbiento <tonylabb@infonline.net>
Subject: Re: Server Side Includes
Message-Id: <35B88130.2CAE060C@infonline.net>

Hector,

	You are confused. When your admin said only .shtml files are parsed
that means that lines like <!--#exec cgi="/cgi-bin/test.cgi"--> can only
be put in files with a .shtml. If you put it in a file called
test_web_page.html it will be ignored! This has nothing to do with the
name of the cgi file itself.

Hector Catre wrote:
> 
> I'm having trouble activating a server side include
> 
> My server administrator said that only file extensions with .shtml will be
> parsed, which lead to the following line:
> 
> <!--#exec cgi="/cgi-bin/test.shtml"-->
> 
> instead of :
> 
> <!--#exec cgi="/cgi-bin/test.cgi"-->
> 
> but this doesn't work.
> 
> What the hech if the differance when they say that only  .shtml files will be
> parsed?
> 
> Hector Catre
> hector@followme.com

-- 
			****************************************
			*    Tony Labbiento                    *
			*    Infinity Online, Inc.             *
			*    Programmer/Network Administrator  *
			****************************************


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

Date: 24 Jul 1998 12:51:41 GMT
From: scott@softbase.com
Subject: Re: Slash vs backslash in nt vs 95?
Message-Id: <35b8835d.0@news.new-era.net>

brianp_sheshunoff@my-dejanews.com wrote:

> I use the slash as the filespace delimiter in Perl scripts I run on NT. The
> -M, -s, -d, and -f file tests work fine. When I try to run the same program
> on 95, I get zero for age, and size and false for directoriness and fileness.
> Changing from slash to escape (backslash) makes them work.

I can't duplicate this behavior:

c:\windows\command>perl -e "print -s 'c:/windows/command/pfe32.exe'"
589824
c:\windows\command>dir PFE32.EXE
 ...
 3/24/97  20:30         589,824  PFE32.EXE

It works on my machine. I recently upgraded to Windows 98, and
am running ActiveState:

This is perl, version 5.003_07
 ...
Perl for Win32 Build 316 - Built 09:44:44 Mar 13 1998

This isn't the latest and greatest, but I am waiting for version 5.005
before I upgrade again.

Is there anything else in the path that might be causing a problem?
Can you post some code?

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: Fri, 24 Jul 1998 12:54:43 GMT
From: "S.R.M. Walsh" <u7srmw@csc.liv.ac.uk>
Subject: spss file format
Message-Id: <35B88413.2F01@csc.liv.ac.uk>

I am a computer science student at the University of Liverpool (U.K)
and I am currently engaged in a project involving spss.
I have created web pages that include an online form which is then
processed by a cgi program (written in Perl5).  The data is saved in
files using name=value,(value),etc.. pairs.  I now wish to write another
perl program that will read in each of these files and convert them into
spss files.  However I do not know what has to be included in these
files and the exact syntax of the contents.  I would be very grateful if
anyone can point me to relevant sources of information.
Thanx
Steven Walsh. 
-- 
"As wide as the ocean, as high as the sky, as deep as the earth..."
                                               John Power (1997)


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

Date: Fri, 24 Jul 1998 08:18:09 -0400
From: Eric Williams <ewilliams@wesleyan.edu>
Subject: Text processing question
Message-Id: <35B87B80.7E8CAA4A@wesleyan.edu>

Hello,

I have read through the FAQ, several books, and tried all kinds of stuff
and cannot seem to solve the following problem. I am sure that it is
just my lack of experience. Maybe someone can suggest a proper solution.

I have lots of different ascii files with columns of data that aren't
necessarily formatted the same from file to file. Also some of the
columns have a blank (whitespace) entries occassionally. I need to read
in all the data, put a substitute string in for any blank entries, merge
this information with properly formatted files of similar data sorted by
the value of the first column of data, and toss out any duplicate lines
of information between the files. An example of the file that I am
cleaning up looks like this:

45676.3671  7.058  0.087  0.128  0.194 1,B
45944.4704  7.076  0.089  0.100  0.177 3,M
45945.4773  7.033  0.068  0.121  0.179 3,M
45946.3938  7.051            0.117  0.184 3,M
45947.3817  7.067  0.078  0.103  0.176 3,M
45948.3526  7.072  0.075  0.104  0.191 3,M
45950.3775  7.069  0.070            0.172 3,M
45951.3732  7.060            0.120  0.190 3,M
45952.3724  7.069  0.093  0.118  0.187 3,M

Each line of data is one record and must remain intact, again sorted by
the value of the first column.

Any recommendations? My instinct is that this should be setup in some
sort of database instead of just ascii files but I have no experience
with that and have inherited hundreds of these ascii files already and
have dozens of update files to merge into them.

Thanks if anyone has the patience to suggest a solution.

Eric
Perl newbie, but loving it!



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

Date: Fri, 24 Jul 1998 12:29:27 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: updating binary file
Message-Id: <35B87F8B.AD05A955@shaw.wave.ca>

Tungyat Wong wrote:
> 
> Hello,
> 
> I am wondering are there a way to update some content in a file 
> without reading the whole file into array? say there is a binary file, 
> and i want to increment a value inside that file by one, how can i 
> modify the content without reading and writing the while file?
> 
> prefer reply with email,
> ty.wong@utoronto.ca
> Thanks

Well, okay, but only 'cause you're from my old school.  I recall having
to pass a basic literacy test before they'd let _me_ in, though.  :-)

See perlfaq5, "How do I randomly update a binary file?"

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: 24 Jul 1998 12:35:24 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: using s///
Message-Id: <6p9v2c$su3@news-central.tiac.net>

In article <35b7ca4c.100793836@news.ua.edu>,
Alexander Weaver <weave005@bama.ua.edu> wrote:
>I've got a text file that I'm trying to do some things with that is
>supposed to be comma-delimited, but there are also commas where they
>aren't supposed to be.
>
>Example record:
>
>"3333","THIS COMMA,GETS IN THE WAY",444444,55555,33333
>
>I would be perfectly happy to change the comma's inside quotation
>marks into colons or some other character before treating the file as
>a comma-delimited.  The desired output for the given example would be

This doesn't directly answer your question but may save you some work.

You might look in section 4 of the frequently asked questions which come
with modern perl distributions,

  perldoc perlfaq4

should display it.  If it diesn't then follow the FAQs link at
http://www.perl.com and check out section 4.

Section 4 contains a question and answer which begin like this:

       How can I split a [character] delimited string except when
       inside [character]? (Comma-separated files)

       Take the example case of trying to split a string that is
       comma-separated into its different fields.  (We'll pretend
       you said comma-separated, not comma-delimited, which is
       different and almost never what you mean.) You can't use
       split(/,/) because you shouldn't split if the comma is
       inside quotes.  For example, take a data line like this:

           SAR001,"","Cimetrix, Inc","Bob Smith","CAM",N,8,1,0,7,"Error, Core Dumped"

       [...]

There are also a couple of modules on the comprehensice perl archive
network (CPAN) which deal with files like this, they're Text::CSV and
Text::CSV_XS (at least) and they let you do stuff like:

  DB<1> use Text::CSV_XS

  DB<2> $csv = Text::CSV_XS->new ()

  DB<3> $status = $csv->parse ('SAR001,"","Cimetrix, Inc","Bob Smith","CAM",N,8,1,0,7,"Error, Core Dumped"')

  DB<4> @columns = $csv->fields ();

  DB<5> X columns
@columns = (
   0  'SAR001'
   1  ''
   2  'Cimetrix, Inc'
   3  'Bob Smith'
   4  'CAM'
   5  'N'
   6  8
   7  1
   8  0
   9  7
   10  'Error, Core Dumped'
)

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


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

Date: Fri, 24 Jul 1998 13:27:21 +0000
From: "David Travis" <david@system-concepts.com>
Subject: Why can't I "require" a file?
Message-Id: <901283176.20914.0.nnrp-07.9e9886e2@news.demon.co.uk>

I'm running a Perl script on my ISP's Apache server and it won't let me 
"require" another file. It's not a permissions problem, since the program 
gets past a check to see if the file exists and is readable. Any 
suggestions?

Here's the code fragment:

    if (-e "$file" && -r "$file")
      {
      require "$file";
      }

The compiler fails at the require line and complains that $file 
"did not return a true value".

david@system-concepts.com


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

Date: Fri, 24 Jul 1998 13:42:45 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Why can't I "require" a file?
Message-Id: <35B88145.E8D6C2DF@nortel.co.uk>

David Travis wrote:
> 
> The compiler fails at the require line and complains that $file
> "did not return a true value".

If you look at perlfunc under require, amongst other useful
explanations, you will see the following:
<quote>
The file must return TRUE as the last statement to indicate successful
execution of any initialization code, so it's customary to end such a
file with ``1;'' unless you're sure it'll return TRUE otherwise. But
it's better just to put the `` 1;'', in case you add more statements. 
</quote>

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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