[17405] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4825 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 6 18:05:48 2000

Date: Mon, 6 Nov 2000 15:05:15 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <973551915-v9-i4825@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 6 Nov 2000     Volume: 9 Number: 4825

Today's topics:
        -e file tester bug <donv@webimpact.com>
    Re: -e file tester bug <ren.maddox@tivoli.com>
    Re: -e file tester bug tltt@my-deja.com
    Re: -e file tester bug <sariq@texas.net>
        Backtick problems on Windows98 <peter.lerup@ecs.ericsson.se>
    Re: Calculating Date Difference <ssearle@somewhere.com>
    Re: character replacements ASCII > 127 only <watsondk@my-deja.com>
    Re: character replacements ASCII > 127 only <watsondk@my-deja.com>
    Re: Communicating with a child process <tim@ipac.caltech.edu>
        Detect client still connected? saze@my-deja.com
    Re: do you know why this doesn't work? <elephant@squirrelgroup.com>
    Re: Duplicate lInes in File count and del routine jkipp@my-deja.com
    Re: Help - read from CSV <james@NOSPAM.demon.co.uk>
    Re: Help - read from CSV <james@NOSPAM.demon.co.uk>
        Help again needed (not so ambitious this time)  :-) (Anthony)
    Re: Help again needed (not so ambitious this time)  :-) <ren.maddox@tivoli.com>
    Re: Help again needed (not so ambitious this time)  :-) (Chris Fedde)
    Re: Help again needed (not so ambitious this time)  :-) (Tad McClellan)
    Re: Help again needed (not so ambitious this time)  :-) (Tad McClellan)
    Re: Help again needed (not so ambitious this time)  :-) <jeff@yoak.com>
        How do I put field names with spaces in SQL statement? (Bryce Pursley)
    Re: How do I put field names with spaces in SQL stateme (Chris Fedde)
    Re: How do I put field names with spaces in SQL stateme <kstep@pepsdesign.com>
    Re: how to sort corresponding arrays? (Chris Fedde)
    Re: Is there a better way to get "the element before $x (Gwyn Judd)
    Re: large file size (Garry Williams)
    Re: large file size <crowj@aol.com>
    Re: Listing X items on each page (Gwyn Judd)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 06 Nov 2000 14:52:20 -0500
From: Don Vaillancourt <donv@webimpact.com>
Subject: -e file tester bug
Message-Id: <3A070BF4.5080100@webimpact.com>

Here is the scenerio.

At work we use PERL 5.005_03 on a Red Hat Linux box.
Our ISP uses PERL 5.005_62 on a BSD box.

The funny thing is that the -e file tester on the PERL version on Red 
Hat doesn't work as intended.  It returns false if the file exists.  But 
on the BSD PERL it returns true.

Has anyone else encountered this problem?

Don







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

Date: 06 Nov 2000 13:55:45 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: -e file tester bug
Message-Id: <m3wvegub7i.fsf@dhcp11-177.support.tivoli.com>

Don Vaillancourt <donv@webimpact.com> writes:

> Here is the scenerio.
> 
> At work we use PERL 5.005_03 on a Red Hat Linux box.
> Our ISP uses PERL 5.005_62 on a BSD box.
> 
> The funny thing is that the -e file tester on the PERL version on Red
> Hat doesn't work as intended.  It returns false if the file exists.
> But on the BSD PERL it returns true.

This doesn't seem very likely.  Could you post some example code?  In
particular, if you are using the results of a readdir, you will need
to include the path when using the file test operators.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Mon, 06 Nov 2000 21:17:19 GMT
From: tltt@my-deja.com
Subject: Re: -e file tester bug
Message-Id: <8u774l$upl$1@nnrp1.deja.com>

Don Vaillancourt wrote:
> Here is the scenerio.
>
> At work we use PERL 5.005_03 on a Red Hat Linux box.
> Our ISP uses PERL 5.005_62 on a BSD box.
>
> The funny thing is that the -e file tester on the PERL version on Red
> Hat doesn't work as intended.  It returns false if the file exists.
> But on the BSD PERL it returns true.
>
> Has anyone else encountered this problem?

Not really, and I would be very surprised if something as commonly used
as the -e test did not work on some versions of perl. If you want a more
helpful reply, try posting some of your code along with the output you
get when running it on the 2 different boxes.

This is what I get:
addict:~/junk$ /usr/bin/perl -version

This is perl, version 5.005_03 built for i386-linux

Copyright 1987-1999, Larry Wall
--- snip ---

addict:~/junk$ cat try
#!/usr/bin/perl -w

if ( -e "try" ) {
   print "I exist\n";
}
else {
    print "I do not exist\n";
}
addict:~/junk$ ./try
I exist

hth,

tltt


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 06 Nov 2000 21:31:45 GMT
From: Tom Briles <sariq@texas.net>
Subject: Re: -e file tester bug
Message-Id: <3A072341.8F08378C@texas.net>

Don Vaillancourt wrote:
> 
> Here is the scenerio.
> 
> At work we use PERL 5.005_03 on a Red Hat Linux box.
> Our ISP uses PERL 5.005_62 on a BSD box.
> 
> The funny thing is that the -e file tester on the PERL version on Red
> Hat doesn't work as intended.  It returns false if the file exists.  But
> on the BSD PERL it returns true.
> 
> Has anyone else encountered this problem?

If so, we likely would've seen it by now...

You should be more careful when throwing around the 'b' word.  At least
show some code to back up your claim.

- Tom


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

Date: Mon, 6 Nov 2000 21:55:24 +0100
From: "Peter Lerup" <peter.lerup@ecs.ericsson.se>
Subject: Backtick problems on Windows98
Message-Id: <8u75do$5a3$1@newstoo.ericsson.se>

Hi

I have a strange phenomenon that I wonder if someone else have seen and
hopefully have the solution for.

The problem is that on some Windows 98 machines the redirection of stdout
doesn't seem to work. Whenever doing anything like

$a = `dir`;

The result of the command goes directly to the console window and not into
the variable.

The strangest thing is that this only happens on some machines and not
others, different hardware but all using the same version of Windows 98.
I've tried several different versions of Win32 Perl but always the same
result.

Thankful for any leads on this

/Peter Lerup
Ericsson Mobile Communications



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

Date: Mon, 6 Nov 2000 15:20:58 -0500
From: "Scott" <ssearle@somewhere.com>
Subject: Re: Calculating Date Difference
Message-Id: <3a07132f@vega>

Hi.

    To do any sort of date manipulation, you should probably convert your
date into something more manageable.  You can convert into seconds since Jan
1, 1970 -- this is called the epoch, using timelocal().  Once you get your
two numbers, subtract and then convert back to readable time using
localtime().

    See the manpages on these two functions for more clues.  I believe there
is also a module that does all this for you.  You can just punch in the
current time, and add or subtract days, hours, years, minutes etc.  Have a
look around CPAN for it.

    -Scott

<balkuwai@celestica.com> wrote in message
news:8u6ie8$b68$1@nnrp1.deja.com...
> Hi,
>
> I'm trying to find out the date exactly 2 weeks before the day my
> script is running.  Is there an easy way of doing this?  I need the
> year, month, day of month to be returned.
>
> I would appreciate your help.
>
> Regards,
> Bashar
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Mon, 06 Nov 2000 22:38:04 GMT
From: ozetechnology <watsondk@my-deja.com>
Subject: Re: character replacements ASCII > 127 only
Message-Id: <8u7bsb$35h$1@nnrp1.deja.com>

Thanks,

In article <8u6hc0$o411@intranews.bank.dresdner.net>,
  "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com> wrote:
>     Hi,
>
> ozetechnology schrieb in Nachricht <8u6bum$5j4$1@nnrp1.deja.com>...
> >I have to read around 9000 html files and replace several known
> >character codes with internet character enterties, then strip out any
> >remaining character code > 127
>
>     have a look at the HTML::Entities modules which has
>     two methods encode_entites() and decode_entities().
>     encode_entities( $string, "\200-\377" ) is probably
>     what you are looking for.
>
>     Best regards,
>
>         Peter Dintelmann
>
>

--
site: http://www.ozetechnology.com
+++ New Images in the gallery +++


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 06 Nov 2000 22:40:39 GMT
From: ozetechnology <watsondk@my-deja.com>
Subject: Re: character replacements ASCII > 127 only
Message-Id: <8u7c15$38u$1@nnrp1.deja.com>

Thanks, sis not think of that one.

But still what do I use as my source for the translation?

In article <Pine.GHP.4.21.0011061551360.8829-100000@hpplus03.cern.ch>,
  "Alan J. Flavell" <flavell@mail.cern.ch> wrote:
> On Mon, 6 Nov 2000, ozetechnology wrote:
>
> > codes other than replacing the known codes is ok, its the greater
than
> > 127 thats giving me problems. I am assuming that I can use the
> > substitution operator like I have for the known replacements.
>
> You'll probably get better mileage with the tr/// operation, using
> its 'd' option to delete the offending characters.
>
>

--
site: http://www.ozetechnology.com
+++ New Images in the gallery +++


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 06 Nov 2000 12:19:10 -0800
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Communicating with a child process
Message-Id: <3A07123E.3D38D3C5@ipac.caltech.edu>

Sean McAfee wrote:
> 
> >Anno Siegel wrote:
> 
> >In this case Sean implied that he can enforce it, because his program is the one
> >sending the text to the child. If it's really a concern, he could add something
> >like this to the parent to watch for conflicts:
> 
> >if($text =~ /^<<<.*>>>$/) {
> >    # modify $text innocuously and/or produce a warning
> >}
> 
> Actually, I can't; the handle to the child may be passed around to many
> different routines, and it's not feasible to require all of them to perform
> this check.  I only regain full control over the handle between chunks of
> input, when I want the counter to be reset.

(untested)

sub print_to_child {
  my $handle = shift;
  my $text   = shift;
  my $cmds   = shift;
  my $rc = 1;
  if($text =~ /^<<<(.*)>>>$/ && ! exists $cmds->{$1}) {
    $rc = print $handle "<<<DATA>>> "; # ... to use Ren's excellent suggestion
  }
  print $handle $text if $rc;
  return $rc;
}

 ... or something like that.

Anyway, I think having all your routines use that sub is alot simpler, more
extensible, more robust and easier to debug than signals and semaphores. But, as
I said, that's obviously your call. Maybe I've just had too many bad experiences
with multi-band IPC ...

> >Re signals: Signals are asynchronous, so making sure the counter reset is
> >synchronized with the text will take some extra work, including perhaps
> >acknowledgement by the child. Ick. This same problem will make many forms of
> >"second channel" communication with the child more complex.
> 
> Actually, I found a solution that's not too bad...

Cool. Good luck with it.

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


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

Date: Mon, 06 Nov 2000 21:56:53 GMT
From: saze@my-deja.com
Subject: Detect client still connected?
Message-Id: <8u79f0$11c$1@nnrp1.deja.com>

I have a Perl CGI script that takes files on the server and streams them
back to the client, having first sent the appropriate headers.  The
files can be quite big (some MB) and may take a minute or two to send -
the script is running all this time, pumping it out to STDOUT a block at
a time.

I want a way to tell if the client is still connected and wanting this
stuff, or has cancelled from their end and gone away, so I can stop the
script as appropriate.  At the moment, the script chunters on
regardless.

It is all made worse by MSIE's great habit of calling a URL twice when
it comes to downloading files (first time to ge the header info, second
time for the whole thing), which means every other call starts a script
which is 99% not needed, in terms of processor time.

So how do I tell from Perl/CGI code that the client is still there.  It
can be done in ASP/VBScript - just use the IsConnected property of the
Response object.  So there must be a way in Perl too - no?

TIA

Steve


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 7 Nov 2000 09:39:07 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: do you know why this doesn't work?
Message-Id: <MPG.1471de1315d982c8989877@localhost>

Garry Williams wrote ..
>On Wed, 1 Nov 2000 13:38:16 +1100, jason <elephant@squirrelgroup.com> wrote:
>>jt_2000_ky@my-deja.com wrote ..
>>>I'm trying to write a simple script to check to make sure a box is up.
>>>I thought the easy part would be to get the Ping module to work
>>>correctly but the script below doesn't work. Any suggestions?
>>...
>>thus endeth the first lesson in testing functions that have command line 
>>equivalents
>
>What makes you think there's a command line equivalent to the
>functionality in Net::Ping?  Did you read the Net::Ping manual page?  

pinging microsoft.com always times out because it doesn't respond to 
pings .. it is the simplest functionality possible that needs to be 
tested because that's all that the originator's code uses from Net::Ping

I'm guessing (because the originator never stated it) that the "doesn't 
work" they were talking about was probably because they expected a 
response from microsoft.com and yet it doesn't respond .. because other 
than that there is nothing unexpected about the code or its output - it 
correctly pings www.virginrecords.com

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Mon, 06 Nov 2000 18:56:33 GMT
From: jkipp@my-deja.com
Subject: Re: Duplicate lInes in File count and del routine
Message-Id: <8u6ust$mt2$1@nnrp1.deja.com>

Thank you both for your responses. Both of your suggestions worked
after some tweeking.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 6 Nov 2000 21:19:46 +0000
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: Help - read from CSV
Message-Id: <ant062146bbafNdQ@oakseed.demon.co.uk>

In article <m3bsvtugk5.fsf@dhcp11-177.support.tivoli.com>, Ren Maddox
<URL:mailto:ren.maddox@tivoli.com> wrote:
>
> James Taylor <james@NOSPAM.demon.co.uk> writes:
> >
> >     push @data, [ split '|', $line ];
> ...
> >     my ($candidate, $votes) = split '|', $line;
> 
> Watch out there... split takes a regex as its first argument, and | is
> special there.  You need to escape it....

Gosh, you're absolutely right! I had been under the misapprehension that
if I used '|' instead of /\|/ that split would treat it as a string rather
than a regex. I've learnt another new thing by posting my mistakes.

Thanks guys.

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Mon, 6 Nov 2000 21:28:54 +0000
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: Help - read from CSV
Message-Id: <ant062154e61fNdQ@oakseed.demon.co.uk>

In article <3A06F38C.35EC4DE2@vpservices.com>, Jeff Zucker
<URL:mailto:jeff@vpservices.com> wrote:
>
> James Taylor wrote:
> >
> >     push @data, [ split '|', $line ];
> 
> Bzzzzt. Wrong. That will turn 'foo|bar|baz' into an 11-element array
> of characters rather than a 3-element array of words.

So it does, thanks for pointing that out.

> > Note that I am a beginner myself, and I have rashly typed the
> > above without testing it at all.
> 
> PLEASE DO NOT DO THAT!

I thought the sin was to post untested code without saying it was
untested, and I did say it was untested. Sorry if I caused anybody to
use duff code. Hopefully though, my mistaken use of split and its very
public correction will go some way to warning others of this possible
misunderstanding. There's a silver lining to every cloud.

> Whom do you imagine is helped by having untested code and
> guesses sent to the newsgroup?

Well, I'd like to think that I don't make mistakes all the time,
and that I can offer *some* assistance to those in need.

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Mon, 06 Nov 2000 21:00:28 GMT
From: apsaffer@hotmail.com (Anthony)
Subject: Help again needed (not so ambitious this time)  :-)
Message-Id: <3a071a70.12925945@news.rectec.net>

Okay, I've decided that I am totally lost on PERL.  I thought I had a
good grasp of it but, as my last post pointed out, I don't. So, I am
going back to basics.  The following code is supposed to read a text
file that is delimited by the | character. When I run the program it
gives me the following error on ALL of my variables:

"variable name" requires explicit package name at test.pl

Below is the code (a very simple program). Could someone tell me what
I am doing wrong?? Please?

Anthony

BEGIN CODE:
#!/usr/local/bin/perl
use strict;

$test_file = "test.txt";
open(TEST, $test_file) || die("Cannot open file!");
@test_elements =<TEST>;
foreach $array_element (@test_elements)
{
chop(array_element);
($first_name, $middle_initial, $last_name)=split(/\|/,
$array_element);
print("Hi, my name is $first_name $middle_initial $last_name\n");
close(TEST);
}



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

Date: 06 Nov 2000 15:11:30 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Help again needed (not so ambitious this time)  :-)
Message-Id: <m3d7g8u7p9.fsf@dhcp11-177.support.tivoli.com>

apsaffer@hotmail.com (Anthony) writes:

> Okay, I've decided that I am totally lost on PERL.  I thought I had a

It may seem nit-picky, but it is "Perl", not "PERL".

> good grasp of it but, as my last post pointed out, I don't. So, I am
> going back to basics.  The following code is supposed to read a text
> file that is delimited by the | character. When I run the program it
> gives me the following error on ALL of my variables:
> 
> "variable name" requires explicit package name at test.pl

If you don't understand one of Perl's diagnostic messages, it can be
very helpful to add "use diagnostics" to your program.  This will give
a more detailed explanation.  You can also just run the text through
the splain program.  Of course, you will need the *actual* message,
which the above is not:

% splain
/usr/bin/splain: Reading from STDIN
Global symbol "$test_file" requires explicit package name
Global symbol "$test_file" requires explicit package name (#1)
    
    (F) You've said "use strict vars", which indicates that all variables
    must either be lexically scoped (using "my"), declared beforehand using
    "our", or explicitly qualified to say which package the global variable
    is in (using "::").
    
> Below is the code (a very simple program). Could someone tell me what
> I am doing wrong?? Please?
> 
> BEGIN CODE:
> #!/usr/local/bin/perl

  use warnings;

> use strict;
> 
> $test_file = "test.txt";
  my $test_file = "test.txt";

> open(TEST, $test_file) || die("Cannot open file!");

You should include $! in the error message so that you can see *why*
the open failed.

> @test_elements =<TEST>;
  my @test_elements = <TEST>;

> foreach $array_element (@test_elements)

But if you're just going to loop over the elements, then you shouldn't
read them all in in the first place.  Instead, use:

  foreach my $array_element (<TEST>)

but that still reads in the whole file, so you should really use:

  while ($array_element = <TEST>)

> {
> chop(array_element);

chomp is the preferred call for removing the line terminator.  Sure,
chop works, but chomp is preferred.  For one thing, it's safer.  If
you accidentally call it twice, no harm is done.  With chop, quite the
opposite is true.  These days, chop is for when you really do want to
remove the last character and you are not just cleaning off newlines.

> ($first_name, $middle_initial, $last_name)=split(/\|/,
> $array_element);

  my($first_name, $middle_initial, $last_name) = split /\|/, $array_element;

> print("Hi, my name is $first_name $middle_initial $last_name\n");
> close(TEST);
> }
> 

Strange place to close the filehandle... inside the loop.  If you're
going to read the whole file into an array as you've done, then you
might as well close the filehandle immediately after doing so.  If you
process the file in the loop as I have suggested, then you will also
need to move the close after the loop.

Also, there's not really much point is using a loop variable for
this.  Some people prefer it, but I recommend that you get used to the
more common:

while(<TEST>) {
  chomp;
  my($first_name, $middle_initial, $last_name) = split /\|/;
  print "Hi, my name is $first_name $middle_initial $last_name\n";
}


-- 
Ren Maddox
ren@tivoli.com


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

Date: Mon, 06 Nov 2000 21:38:04 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Help again needed (not so ambitious this time)  :-)
Message-Id: <0xFN5.207$Bf7.171120128@news.frii.net>

In article <3a071a70.12925945@news.rectec.net>,
Anthony <apsaffer@hotmail.com> wrote:
>
>"variable name" requires explicit package name at test.pl
>
>BEGIN CODE:
>#!/usr/local/bin/perl
>use strict;
>
>$test_file = "test.txt";
>open(TEST, $test_file) || die("Cannot open file!");
>@test_elements =<TEST>;
>foreach $array_element (@test_elements)
>{
>chop(array_element);
>($first_name, $middle_initial, $last_name)=split(/\|/,
>$array_element);
>print("Hi, my name is $first_name $middle_initial $last_name\n");
>close(TEST);
>}
>

Put 'my ' in front of the first use of each variable name.
alternately put a '#' in front of the use strict line.

chris
-- 
    This space intentionally left blank


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

Date: Mon, 6 Nov 2000 15:38:38 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help again needed (not so ambitious this time)  :-)
Message-Id: <slrn90e5me.46i.tadmc@magna.metronet.com>

On Mon, 06 Nov 2000 21:00:28 GMT, Anthony <apsaffer@hotmail.com> wrote:

>Okay, I've decided that I am totally lost on PERL.  


We can tell (because nobody spells it that way).

Perl is used to refer to the language proper.

perl is used to refer to the implementation of the language (interpreter).

PERL is not used (except by the clued to identify the unclued).


>I thought I had a
>good grasp of it but, as my last post pointed out, I don't. So, I am
>going back to basics.  


A very good move.


>The following code is supposed to read a text
>file that is delimited by the | character. When I run the program it
>gives me the following error on ALL of my variables:
>
>"variable name" requires explicit package name at test.pl
>
>Below is the code (a very simple program). Could someone tell me what
>I am doing wrong?? Please?
>
>Anthony
>
>BEGIN CODE:
>#!/usr/local/bin/perl
>use strict;
 ^^^^^^^^^^


If you type:

   perldoc strict

it will describe what you are asking for when you include that.


The short version is:

   You must declare all of your variables using my().


>$test_file = "test.txt";


   my $test_file = "test.txt";
   ^^

That fixes your problem, but I have a few more pointers for you below.


>open(TEST, $test_file) || die("Cannot open file!");


   open(TEST, $test_file) || die("Cannot open '$test_file'!  $!");
                                                             ^^

>@test_elements =<TEST>;
>foreach $array_element (@test_elements)


No need for a temporary array:

   foreach my $array_element ( <TEST> ) 
           ^^


>{
>chop(array_element);


use chomp(), not chop() for removing line endings.

Do not use bare words, quote your strings.

Do not attempt to type in code. Use copy/paste or "import" or
something, else you will just get a bunch of smart ass comments
about your typos instead of about your real problem.

Good luck!


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


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

Date: Mon, 6 Nov 2000 15:50:40 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help again needed (not so ambitious this time)  :-)
Message-Id: <slrn90e6d0.495.tadmc@magna.metronet.com>

On Mon, 06 Nov 2000 21:38:04 GMT, Chris Fedde 
   <cfedde@fedde.littleton.co.us> wrote:

>alternately put a '#' in front of the use strict line.


I turn up the volume of my car radio to fix "funny noises"
that the car makes. Seems to work good...

:-)


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


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

Date: Mon, 06 Nov 2000 13:41:04 +0800
From: "Jeff Yoak" <jeff@yoak.com>
Subject: Re: Help again needed (not so ambitious this time)  :-)
Message-Id: <8u78jm0232v@news1.newsguy.com>

In article <3a071a70.12925945@news.rectec.net>, "Anthony"
<apsaffer@hotmail.com> wrote:

> Okay, I've decided that I am totally lost on PERL.  I thought I had a
> good grasp of it but, as my last post pointed out, I don't. So, I am
> going back to basics.  The following code is supposed to read a text
> file that is delimited by the | character. When I run the program it
> gives me the following error on ALL of my variables:
> 
> "variable name" requires explicit package name at test.pl

Those errors are arising because you aren't declaring your variables
explicitly as required by the strict pragma, which are properly using.
Try:

perldoc strict

and look over what it has to say in the the strict vars section.  What
you will probably want to do in the case of the code you posted is
precede the first usage of each variable with the keyword, 'my' such as
in:

my $test_file = "text.txt";

Good luck!

Cheers,
Jeff


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

Date: Mon, 06 Nov 2000 21:19:45 GMT
From: hbpursle@duke-energy.com (Bryce Pursley)
Subject: How do I put field names with spaces in SQL statement?
Message-Id: <3a071ed3.541926939@news.infoave.net>

I'm using the Win32::ODBC module from ActiveState to access a MS
Access database.  Some of the fields in this database have spaces in
them.  I can't get the SELECT statement to work when those fields are
included.

$SqlStatement = "SELECT HOST1,HOST2,P1 LINK NAME,HOST3 FROM INFO";

One of the field names is "P1 LINK NAME" and I have tried with single
quotes around it but that seems to create a new field somehow rather
than use the existing field.

$SqlStatement = "SELECT HOST1,HOST2,'P1 LINK NAME',HOST3 FROM INFO";



How do I make this work?

Bryce


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

Date: Mon, 06 Nov 2000 21:34:56 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: How do I put field names with spaces in SQL statement?
Message-Id: <4uFN5.206$Bf7.171120128@news.frii.net>

In article <3a071ed3.541926939@news.infoave.net>,
Bryce Pursley <hbpursle@duke-energy.com> wrote:
>
>One of the field names is "P1 LINK NAME" and I have tried with single
>quotes around it but that seems to create a new field somehow rather
>than use the existing field.
>

I'm no expert but I think that SQL (at least standard SQL) does not
allow spaces in field names.  Maybe if you asked this question in a
group that had 'sql' somewhere in it's name you'd get a more
definitive answer.

chris
-- 
    This space intentionally left blank


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

Date: Mon, 6 Nov 2000 17:26:57 -0500
From: "Kurt Stephens" <kstep@pepsdesign.com>
Subject: Re: How do I put field names with spaces in SQL statement?
Message-Id: <8u7b7g$lo3$1@nntp9.atl.mindspring.net>

Hi Bryce,

To specify a field name that contains spaces, enclose the name in [square
braces].

$SqlStatement = "SELECT HOST1, HOST2, [P1 LINK NAME], HOST3 FROM INFO"

This syntax is specific to the MS Access/Jet driver.  Other drivers may use
a different syntax, if they allow spaces at all.

I hope this helps,

Kurt Stephens
kstep@pepsdesign.com





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

Date: Mon, 06 Nov 2000 21:18:04 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: how to sort corresponding arrays?
Message-Id: <geFN5.205$Bf7.188786688@news.frii.net>
Keywords: browse, forbid, gasify, practicable

In article <8u5gdk$sh1$1@provolone.cs.utexas.edu>,
Logan Shaw <logan@cs.utexas.edu> wrote:
>In article <v9qN5.193$Bf7.170932224@news.frii.net>,
>Chris Fedde <cfedde@fedde.littleton.co.us> wrote:
>>In article <3a04a234.5467$135@news.op.net>,
>>Mark-Jason Dominus <mjd@plover.com> wrote:
>>>
>>>See
>>>
>>>        http://perl.plover.com/yak/hw2/slide003.html
>>>
>>
>>404
>
>As long as we're answering cryptically:
>
>        $ wget --quiet --output-document=- \
>                http://perl.plover.com/yak/hw2/slide003.html |
>                grep -c TITLE
>        1
>        $ 
>

Maybe it's just me but...

    fetch -1 http://perl.plover.com/yak/hw2/slide003.html 
    fetch: slide003.html: Not Found

chris
-- 
    This space intentionally left blank


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

Date: Mon, 06 Nov 2000 20:23:23 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Is there a better way to get "the element before $x" in an array?
Message-Id: <slrn90e4pn.bcb.tjla@thislove.dyndns.org>

I was shocked! How could Tim Conrow <tim@ipac.caltech.edu>
say such a terrible thing:
>Gwyn Judd wrote:
>> Not quite. It creates an array with size equal to the number of letters
>> found. Also the given solution accesses past the end of the array.
>
>Picky mode: How does it do that? The resultant index to @letters has to be

That was an error on my part. I was thinking $#array contains the number
of items in @array but actually it's that minus 1.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Beam me up, Scotty, there's no intelligent life down here!


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

Date: Mon, 06 Nov 2000 20:54:05 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: large file size
Message-Id: <NTEN5.664$FG.43501@eagle.america.net>

On 06 Nov 2000 10:26:25 -0600, Ren Maddox <ren.maddox@tivoli.com>
wrote:
>Dave's box <dshaklee@dtic.mil> writes:
>
>> I have a 4 gb file that I can't open with   "open(LOG, "$log") ||
>> die "Unable to open $log\n";
 ...
>> Does perl have a file size limitation?   When I split the file in 2
>> it will work .  Thanks
>
>It may be an OS limitation...

You should check Clay's post in this thread:
<slrn90dnpp.ctq.clay@panix3.panix.com>

-- 
Garry Williams


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

Date: Mon, 06 Nov 2000 16:51:24 -0500
From: John Crowley <crowj@aol.com>
Subject: Re: large file size
Message-Id: <3A0727DC.73EFBC78@aol.com>

sridhasr@my-deja.com wrote:
> 
> If your OS utilities like cat, grep etc can read this file you can do
> something like this
> 
> open (HANDLE, "cat '$file'|");
> 
> This will work only if cat works for > 2G files
> 
> -Srikanth
> 
> In article <3A06E56A.61123EA2@aol.com>,
>   crowj@aol.com wrote:

[snip]

> > You need to recompile Perl using the compiler-specific
> > large file size option(s).
> >
> 

Good idea.

Just a warning though, I have seen machines where the Unix utilities
also do not match.


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

Date: Mon, 06 Nov 2000 21:45:54 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Listing X items on each page
Message-Id: <slrn90e9kg.bcb.tjla@thislove.dyndns.org>

I was shocked! How could Eirik Johansen [netmaking.com] <eirik@netmaking.com>
say such a terrible thing:
>I have a directory that contains images, named "1.gif", "2.gif"
>and so on. I'm constanly adding new images, and have therefore
>been thinking about automating the process of displaying these
>images on a web page. Here's is what I'm struggeling to find out
>how to do:
>
>Is there anyone who would be as kind as to give me a brief
>explanation of how the coding for this would be, and perhaps even
>gime in an example.

Nothing here is really Perl specific. You should ask in a CGI group such
as

comp.infosystems.www.authoring.cgi

I hope that helps

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
You will be dead within a year.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 4825
**************************************


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