[12829] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 239 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 23 19:07:26 1999

Date: Fri, 23 Jul 1999 16:05:13 -0700 (PDT)
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, 23 Jul 1999     Volume: 9 Number: 239

Today's topics:
    Re: basename regexp? <kejoki@netdoor.com>
    Re: duplicating double quotes in text (Tad McClellan)
    Re: file manipulation <laurens@bsquare.com>
    Re: file manipulation <emschwar@rmi.net>
    Re: Geekspeak Programming Contest (Larry Rosler)
    Re: Geekspeak Programming Contest (Anno Siegel)
    Re: Geekspeak Programming Contest <dgris@moiraine.dimensional.com>
    Re: Has anyone seen this error before (Anno Siegel)
    Re: Has anyone seen this error before (Tad McClellan)
    Re: Has anyone seen this error before <aqumsieh@matrox.com>
    Re: How to give Passwords on STDIN (I R A Darth Aggie)
    Re: http_referer problems (Abigail)
        My newbie solution - is this the best? breslow_marty@tandem.com
    Re: My newbie solution - is this the best? (Larry Rosler)
    Re: Need help with a ^M/newline issue (Anno Siegel)
    Re: no such file when executing perl script (Abigail)
    Re: no such file when executing perl script (Abigail)
        Perl 4 Source Code or Binaries (Inge)
    Re: perl and java (Abigail)
    Re: printing in perl (Abigail)
        Problem dereferencing hash <moconnor@publiconline.co.uk>
    Re: regex mathcing (Larry Rosler)
    Re: Regex-ing (Tad McClellan)
    Re: Regex-ing (Larry Rosler)
        sort routines <lfriedl@genome.wi.mit.edu>
    Re: sorting multidim. arrays <aqumsieh@matrox.com>
    Re: sorting multidim. arrays (Abigail)
    Re: SQL statements and ODBC <mlopresti@bigfoot.com>
    Re: Submitting Photos (Abigail)
    Re: Telnet via CGI? harris_m@my-deja.com
    Re: Testing a file to see if it's already open (Anno Siegel)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Fri, 23 Jul 1999 16:23:19 -0500
From: Kevin Kinnell <kejoki@netdoor.com>
Subject: Re: basename regexp?
Message-Id: <3798DD47.471430F@netdoor.com>

Ronald J Kimball wrote:
[snip]
> A basename regexp, you say?
> 
> ($script = $0) =~ s/(.*)/use File::Basename;basename($1)/se;
> 
> Enjoy!

"Some people say the sky is just the sky, but I say --
"Why deny the obvious, child?  Why deny the obvious, child?"

'B)>

--kjk


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

Date: Fri, 23 Jul 1999 12:15:20 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: duplicating double quotes in text
Message-Id: <oe4an7.8rd.ln@magna.metronet.com>

breslow_marty@tandem.com wrote:

: For example, change:
: Photo is 5" x 7"
: to:
: Photo is 5"" x 7""


   s/"/""/g;


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


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

Date: Fri, 23 Jul 1999 14:52:31 -0700
From: "Lauren Smith" <laurens@bsquare.com>
Subject: Re: file manipulation
Message-Id: <7nao7r$tnk$1@brokaw.wa.com>

Dan Adams wrote in message
<932754508.24302.0.nnrp-02.c2deb1c5@news.demon.co.uk>...
>Hi,
>
>Following a number of posts to this group, not a single person has been
>willing and able to help me out to the required extent with some code that
I
>am stumbling over.
Seeing as how this post contains a full 0% of code-like content, let's
assume that you're talking about your previous post about reading and
cutting and pasting file stuff.

Wait a second, someone DID reply to your previous post!  Eric the Read
actually responded to your previous post with a pointer to the FAQ:

<Eric>
"It appears the question in perlfaq5:

"How do I change one line in a file/delete a line in a file/insert a
line in the middle of a file/append to the beginning of a file?"
</Eric>

Now this may not be exactly what you were talking about, and he may be
pointing you to the wrong FAQ.  Since he is unsure of what you mean, he asks
for more information about your problem:

<Eric>
"Could you please enlighten us as to what you want to do?  The problem
with fuzzy specs is you get fuzzy answers."
</Eric>

Searching on Deja.com I find a short thread between you and Mr. the Read
discussing the problem.  In fact he was very generous in his assistance.
I'll assume that you never received it:
http://x26.deja.com/getdoc.xp?AN=501884186&search=thread&CONTEXT=932766085.1
97656673&HIT_CONTEXT=932766085.197656673&HIT_NUM=1&hitnum=3

There's a very good start to what you want to do.

>Since no-one is willing to help me for free, can I induce
>anyone to help me by offering payment?
Your first born sacrificed to a graven image of me... That would be nice...

>I only need about 10 lines or so of
>code that I am stuck on,
Where is this code?  Do you want someone to write it for you?

>but no-one seems willing to help me fix the
>problem.
Eric the Read is going to be disappointed to hear that he's no-one...

>Dan Adams
>dan@fearsome.net


Lauren





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

Date: 23 Jul 1999 16:38:50 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: file manipulation
Message-Id: <xkfiu7bj8jp.fsf@valdemar.col.hp.com>

"Lauren Smith" <laurens@bsquare.com> writes:
> Dan Adams wrote in message
> >but no-one seems willing to help me fix the
> >problem.
>
> Eric the Read is going to be disappointed to hear that he's no-one...

Nah; I'm not bad at pointing out problems, but I'm a lousy teacher,
because I vastly prefer the Socratic method vs. just giving the answer.

-=Eric


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

Date: Fri, 23 Jul 1999 14:33:29 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Geekspeak Programming Contest
Message-Id: <MPG.12027f85b13cf854989d2a@nntp.hpl.hp.com>

In article <3798AFC7.620DCF8F@netdoor.com> on Fri, 23 Jul 1999 13:09:11 
-0500, Kevin Kinnell <kejoki@netdoor.com> says...
 ...
> Jan 1, 2001 = Jan 1, 2000

I don't get that.  ITYM:

  Jan 1, 2000 = Jan 1, 1900

or, even better,

  Jan 1, 2000 = Jan 1, 19100

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 23 Jul 1999 22:06:01 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Geekspeak Programming Contest
Message-Id: <7nap09$200$1@lublin.zrz.tu-berlin.de>

Larry Rosler <lr@hpl.hp.com> wrote in comp.lang.perl.misc:
>In article <3798AFC7.620DCF8F@netdoor.com> on Fri, 23 Jul 1999 13:09:11 
>-0500, Kevin Kinnell <kejoki@netdoor.com> says...
>...
>> Jan 1, 2001 = Jan 1, 2000
>
>I don't get that....

You must never have had the pleasure to watch one of those interminable
threads about when the new millennium "really" begins.  The fun you
missed...

Anno


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

Date: 23 Jul 1999 16:22:01 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Geekspeak Programming Contest
Message-Id: <m3673bxb06.fsf@moiraine.dimensional.com>

anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:

> Larry Rosler <lr@hpl.hp.com> wrote in comp.lang.perl.misc:
> >In article <3798AFC7.620DCF8F@netdoor.com> on Fri, 23 Jul 1999 13:09:11 
> >-0500, Kevin Kinnell <kejoki@netdoor.com> says...
> >...
> >> Jan 1, 2001 = Jan 1, 2000
> >
> >I don't get that....
> 
> You must never have had the pleasure to watch one of those interminable
> threads about when the new millennium "really" begins.  The fun you
> missed...

The new millennium started last Tuesday.

dgris
-- 
Train of thought derailed.  6 dead.  Film at 11


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

Date: 23 Jul 1999 21:08:40 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Has anyone seen this error before
Message-Id: <7nalko$1qa$1@lublin.zrz.tu-berlin.de>

Larry Rosler <lr@hpl.hp.com> wrote in comp.lang.perl.misc:
>> > On Fri, 23 Jul 1999 14:35:10 GMT, Jim Ray <jim.ray@west.boeing.com> wrote:

>> > >I am getting the following error:
>> > >Use of uninitialized value at z:\Inetpub\wwwroot\division\cgi-bin\myfile.pl

[...]

>However, as there half a dozen possible undefined values in that 
>statement, how come 'perl -w' isn't kind enough to tell us which one(s)?  
>It must know, for sure.  (I know, I know, patches accepted.  Sure!)

Man wouldn't that be great.  But then, it doesn't even get the line
number right in some cases, so there may be more to it than is
apparent.

Anno


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

Date: Fri, 23 Jul 1999 12:07:15 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Has anyone seen this error before
Message-Id: <jv3an7.4pd.ln@magna.metronet.com>

Jim Ray (jim.ray@west.boeing.com) wrote:
: I am getting the following error:
: Use of uninitialized value at z:\Inetpub\wwwroot\division\cgi-bin\myfile.pl
: line 242, chunk 8
            ^^^^^^^

   If you haven't changed the value of the $/ special variable,
   then something happened when reading the 8th line. I'd go
   have a look at that data line too.


: Here is line 242:

: $Save[$count] = "$level;$arg1;$FileTitle;white;;$date;$FileType";
        ^^^^^^     ^^^^^^ ^^^^^ ^^^^^^^^^^        ^^^^^ ^^^^^^^^^

: I have access this array serveral times before this happens.  Does anyone
: know what this error is tryng to say?  


   You are using a variable that has never been given a value.

   You have 6 variables there that might be uninitialized.

   One of them is very likely not getting set like you think it
   is. We cannot help you with that, since you didn't show the
   code where each is being set to a value.


   Print them all out and see:

print "count '$count'\n";
print "level '$level'\n";
 ...


: I have tried to research this, but
: have no found a reference of it.


   Really?

   What kind of research did you try?

   The very first place to research for **any** perl problem is
   the documentation that came with perl.


   All of the messages that perl might generate are documented
   in the 'perldiag.pod' file that comes with perl.

   For your message it says:


----------------
=item Use of uninitialized value

(W) An undefined value was used as if it were already defined.  It was
interpreted as a "" or a 0, but maybe it was a mistake.  To suppress this
warning assign an initial value to your variables.
----------------


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


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

Date: Fri, 23 Jul 1999 15:38:03 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Has anyone seen this error before
Message-Id: <x3yr9lzp36s.fsf@tigre.matrox.com>


lr@hpl.hp.com (Larry Rosler) writes:

> However, as there half a dozen possible undefined values in that 
> statement, how come 'perl -w' isn't kind enough to tell us which one(s)?  
> It must know, for sure.  (I know, I know, patches accepted.  Sure!)

I made this suggestion to p5p once, and I was told that many people
attempted to do it, but apparently it is not that easy.
I am still determined to one day look into it once I have more free
time to dive into Perl's guts (unless someone else beats me to it).

Ala



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

Date: 23 Jul 1999 21:19:24 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: How to give Passwords on STDIN
Message-Id: <slrn7phn72.3td.fl_aggie@thepentagon.com>

On 23 Jul 1999 15:43:45 -0500, Abigail <abigail@delanet.com>, in
<slrn7phkup.2f3.abigail@alexandra.delanet.com> wrote:
+ Marc Haber (Marc.Haber-usenet@gmx.de) wrote on MMCLII September MCMXCIII
+ in <URL:news:7na8qp$h6r$1@news.rz.uni-karlsruhe.de>:

+ '' What if his program run on a variety of systems and he doesn't want to
+ '' have to install Readkey.pm on all of them?

+ And that's different from installing his program on a variety of systems,
+ because of... ?

You're not suggesting that someone go to the trouble of making a
Makefile, or, *gasp*, a perl program to automate installation?

James


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

Date: 23 Jul 1999 16:19:48 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: http_referer problems
Message-Id: <slrn7phn2c.2f3.abigail@alexandra.delanet.com>

George Crane (georgec@webleicester.co.uk) wrote on MMCLII September
MCMXCIII in <URL:news:mN1m3.9$zq4.99@news1-hme0.mcmail.com>:
,, 
,, Why is the environment key HTTP_REFERER always empty?

Because it isn't set? As the name "environment key" (better would be
"environment variable") indicates, it's up to the *environment* to set
it. So, this is not the appropriate place to ask. Ask in a group that
discusses your environment, whatever it is.

,,                                                       How can you find the
,, name of the page or server that is calling your script?

You can't. Read the RFC.

,,                                                         IE to stop unwanted
,, people from calling your scripts?


Use authentication. The referer header can be spoofed, doesn't have to
be set, and very importantly, in several case *SHOULD NOT* be set.

RTFRFC.

Of course, none of this has anything to do with Perl.

Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


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


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

Date: Fri, 23 Jul 1999 21:43:36 GMT
From: breslow_marty@tandem.com
Subject: My newbie solution - is this the best?
Message-Id: <7nanm6$vr7$1@nnrp1.deja.com>

I found that after the strip of STDIN the field had a beginning and
trailing quote so I used substr to remove them.  Then I used
substitution with the g modifier to substitute "" for " and that
worked.  I then concatenated the result to get the final product
i.e., '"' . $newstring . '",'
Is this best way?  I guess I was hoping for the opposite of tr's
duplicate removal but that's not automated in the language.
In article <7na270$oo4$1@nnrp1.deja.com>,
  breslow_marty@tandem.com wrote:
> What is the easiest way to double quotes in strings.
> For example, change:
> Photo is 5" x 7"
>
> to:
>
> Photo is 5"" x 7""
>
> Eventually, I want to put quotes and a comma around the whole thing to
> get:
>
> "Photo is 5"" x 7""",
>
>        Thanks
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>


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


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

Date: Fri, 23 Jul 1999 15:55:57 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: My newbie solution - is this the best?
Message-Id: <MPG.120292daaccbc659989d2d@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7nanm6$vr7$1@nnrp1.deja.com> on Fri, 23 Jul 1999 21:43:36 
GMT, breslow_marty@tandem.com <breslow_marty@tandem.com> says...
> I found that after the strip of STDIN the field had a beginning and
> trailing quote so I used substr to remove them.  Then I used
> substitution with the g modifier to substitute "" for " and that
> worked.  I then concatenated the result to get the final product
> i.e., '"' . $newstring . '",'
> Is this best way?  I guess I was hoping for the opposite of tr's
> duplicate removal but that's not automated in the language.

Well, I can do it all in a 'one-liner', though that may not matter to 
you.  :-)

#/usr/local/bin/perl -w
use strict;

$_ = '"double"these"interior"quotes"';

s/"(.+)"/"${\do{(my$x=$1)=~s|"|""|g;$x}}",/;

# For a bit more legibility.  :-)
# s/"(.+)"/"${\do {(my $x = $1) =~ s|"|""|g; $x}}",/;

print "$_\n";
__END__

Golf, anyone?

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 23 Jul 1999 22:44:55 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Need help with a ^M/newline issue
Message-Id: <7nar97$21e$1@lublin.zrz.tu-berlin.de>

Garth Sainio <modred@shore.net> wrote in comp.lang.perl.misc:
>In article <3798ACDD.CA43541D@eis.noaa.gov>, Bob Freedman
><bob.freedman@eis.noaa.gov> wrote:
>
>> I am receiving an HTML file with newline characters and ^M at the end of
>> lines.
>> 
>> I am trying to replace the ^M with \n but am having no success.
>> 
>> I tried the follwing:
>> 
>> $document =~ s/\n+/\n/g; #seems to have no effect
>> 
>> $document =~ s/\n+//g;   #seems to get rid of both ^M and \n
>> 
>> $document =~ s/\n{2,}//g;#seems to have no effect
>> 
>> HELP!!!
>
>Well, there are at least two or three other threads addressing this same
>issue. Basically, the ^M is represented by \r, try working with that and
>see what happens.

Quite so.  However, if you happen to know a character is control-<somechar>
you can use \c<somechar> ( \cM, in this instance) without having to determine 
which escape representation, if any, gives you that beast.

Anno


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

Date: 23 Jul 1999 16:23:41 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: no such file when executing perl script
Message-Id: <slrn7phn9k.2f3.abigail@alexandra.delanet.com>

Chris Lott (chrisl@muskox.alaska.edu) wrote on MMCLI September MCMXCIII
in <URL:news:7n831p$ga7$1@news.alaska.edu>:
** Why would a file run fine if I use
** perl program.pl
** 
** but fail with the error:
** ": No such file or directory
** 
** when I use ./program.pl ?


There's an error on the very first line.



Abigail
-- 
package Z;use overload'""'=>sub{$b++?Hacker:Another};
sub TIESCALAR{bless\my$y=>Z}sub FETCH{$a++?Perl:Just}
$,=$";my$x=tie+my$y=>Z;print$y,$x,$y,$x,"\n";#Abigail


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


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

Date: 23 Jul 1999 16:26:00 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: no such file when executing perl script
Message-Id: <slrn7phne2.2f3.abigail@alexandra.delanet.com>

Chris L (fncll@uaf.edu) wrote on MMCLII September MCMXCIII in
<URL:news:7naa4r$rgj$1@nnrp1.deja.com>:
[] 
[] I thought of that, but the line is indeed correct. It is exactly the
[] same as the test script which does work fine. I tried deleting the
[] shebang line and retyping it (in case there were hidden characters or
[] something)  as well as copying it from the working file. No dice.
[] 
[] In addition, I found out something strange. If I add -w to the shebang
[] line, then it invokes just fine with ./program.pl! When I run it from
[] the command line using -w, I get a couple of warnings about using
[] uninitialized variables, but nothing else...
[] 
[] Why would adding -w to the shebang line cause it to execute properly?
[] This is really driving me batty. Something else, even stranger, is that
[] without -w I type ./program.pl and get this response:
[] 
[] bash: ./program.pl: No such file or directory
[] 
[] but add the -w to the shebang line and it runs fine!


Are you by any chance doing your editing from a M$ OS? Try using vi
from bash itself.



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


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


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

Date: Fri, 23 Jul 1999 21:58:51 GMT
From: ingej@mnl.com (Inge)
Subject: Perl 4 Source Code or Binaries
Message-Id: <3798e4c0.876909479@news.ncal.verio.com>

Where can I find source code for Perl 4, or even better, binaries?
We're upgrading to Solaris 2.6 and have legacy Perl 4 modules (which
we will upgrade to Perl 5 soon, but not right now).

Thanks in advance,
Inge


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

Date: 23 Jul 1999 16:27:19 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: perl and java
Message-Id: <slrn7phngh.2f3.abigail@alexandra.delanet.com>

Marc Simard (marc@multicorpora.ca) wrote on MMCLII September MCMXCIII in
<URL:news:WPZl3.634$nb2.47618@wagner.videotron.net>:
^^ Hi !
^^ I jus want to know how can i make my perl script write "print" for


print "print";


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


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


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

Date: 23 Jul 1999 16:31:06 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: printing in perl
Message-Id: <slrn7phnnk.2f3.abigail@alexandra.delanet.com>

Kaimar (kaimar@ut.ee) wrote on MMCLII September MCMXCIII in
<URL:news:379851A5.C2D3DF2A@ut.ee>:
<> 
<> how to print out something in perl to a printer, not to a command prompt
<> or to a file?


local *LP;
open   LP, "| lp" or die "Failed to open pipe: $!";
print  LP  "Hello, snugglebunnies!\n";
close  LP   or die "Failed to close pipe: $!";



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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


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

Date: Fri, 23 Jul 1999 21:05:20 +0100
From: Michael O'Connor <moconnor@publiconline.co.uk>
Subject: Problem dereferencing hash
Message-Id: <3798CB00.490F@publiconline.co.uk>

Hi,

I'm hoping someone can tell me how to scan a hash which has been passed
to a subroutine as a reference e.g.

 sub1(\%hash1);

 ...

sub sub1
{
my $hash = $_[0];
my @keys = keys $$hash;

 ...
}

The last line of code above gives the error "Type of arg 1 to keys must
be hash (not scalar deref)" yet something like the following works fine
in its place:

 $$hash{'key'} = value;

I'm unable to find the syntax that allows the erroneous line to work.

Thanks for any help,

Michael



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

Date: Fri, 23 Jul 1999 15:27:55 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: regex mathcing
Message-Id: <MPG.12028c44c39e107e989d2c@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7naj4d$uh7$1@nnrp1.deja.com> on Fri, 23 Jul 1999 20:25:59 
GMT, pozman@my-deja.com <pozman@my-deja.com> says...
> If I have a string and want to know how many occurance there are of
> another particular string within the first one, is there a regular
> expression to  do that.

perlfaq4: "How can I count the number of occurrences of a substring 
within a string?"

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 23 Jul 1999 11:59:32 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Regex-ing
Message-Id: <4h3an7.4pd.ln@magna.metronet.com>

Ben Meghreblian (ben@NOSPAMcognitech.co.uk) wrote:

: $news = s/\n/delimiter/g;
        ^
        ^  assignment operator

   $news =~ s/\n/delimiter/g;
         ^^
         ^^ binding operator


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


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

Date: Fri, 23 Jul 1999 15:01:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Regex-ing
Message-Id: <MPG.1202862416060f19989d2b@nntp.hpl.hp.com>

In article <379bbe40.15991274@nntp.ix.netcom.com> on Fri, 23 Jul 1999 
19:20:56 GMT, Michael Rubenstein <miker3@ix.netcom.com> says...
 ...
> 	$news =~ s/(?:\r\n?)|(?:\n\r?)/delimiter/g;
                 ^^^     ^ ^^^     ^

I posted this earlier without all that noise.  Alternation ('|') has the 
lowest precedence in a regex.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 23 Jul 1999 17:33:21 -0400
From: Lisa Friedland <lfriedl@genome.wi.mit.edu>
Subject: sort routines
Message-Id: <3798DFA1.7A2C86AA@genome.wi.mit.edu>


I have some commonly used sort subroutines I'd like to put in a
package.  However, as the perl book points out, "You do need to make
sure your sort routine is in the same package though, or qualify $a and
$b with the package name of the caller."  How do I get at that?

Instead of 
sub in_order {
        my @a = split(/(\d+)/, $a);
        my @b = split(/(\d+)/, $b);

I must need something like:
        my @a = split(/(\d+)/, MAIN::$a);
        my @b = split(/(\d+)/, MAIN::$b);
but I don't know what it's called.

thanks,
-Lisa


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

Date: Fri, 23 Jul 1999 15:18:57 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: sorting multidim. arrays
Message-Id: <x3yso6fp42m.fsf@tigre.matrox.com>


"E. Seifert" <Erich.Seifert@dachau.baynet.de> writes:

> I want to sort a multidimensional array by the first elements of its
> subarrays.
> How can I do that?

By reading the mighty FAQs. From perlfaq4:

     How do I sort an array by (anything)?

It contains all the necessary info.
HTH,
Ala



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

Date: 23 Jul 1999 16:37:08 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: sorting multidim. arrays
Message-Id: <slrn7pho2u.2f3.abigail@alexandra.delanet.com>

E. Seifert (Erich.Seifert@dachau.baynet.de) wrote on MMCLII September
MCMXCIII in <URL:news:379857A1.A3B65ABA@dachau.baynet.de>:
;; 
;; I want to sort a multidimensional array by the first elements of its
;; subarrays.
;; How can I do that?


RTFFAQ.



Abigail
-- 
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))


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


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

Date: Fri, 23 Jul 1999 17:14:31 -0400
From: Matt <mlopresti@bigfoot.com>
Subject: Re: SQL statements and ODBC
Message-Id: <3798DB37.FC4B94D4@bigfoot.com>

Are you using mSQL? If so, have you tried to run the second query in MS
Query? What error does that give you?


danny wrote:

> Hi,
>
> i'm working with ODBC at the moment (win32)
>
> i got a table named table1
>  with 3 fields
>         field1
>         field2
>         field3
>
> )
> sql statement
> $db->Sql("select * from table1");
> is working fine
>
> BUT
>
> $db->Sql("select field1 from table1");
> is giving an error
>
> something like : the selected configuration of the sort direction isn't
> supported by the operating system
>
> i'm using win95 and is this the error ?
>
> i need help ..
>
> danny




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

Date: 23 Jul 1999 16:39:21 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Submitting Photos
Message-Id: <slrn7pho73.2f3.abigail@alexandra.delanet.com>

Trevor Milley (jac@rom.com) wrote on MMCLII September MCMXCIII in
<URL:news:3799b1e4.105698050@news.thezone.net>:
 .. I'm trying to develop a photo gallery on a website and I'm wondering
 .. if it is possible for people to give the path to their photo on their
 .. hard drive and for the script to copy that file to a database on the
 .. server.  The only other option I can think of is getting the people to
 .. just email the photos in but I would prefer to have a script do it
 .. instead.  If anyone can help it would be greatly appreciated.


Well, yes, that's certainly possible.

It's not the way I would do it though.




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


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


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

Date: Fri, 23 Jul 1999 21:25:27 GMT
From: harris_m@my-deja.com
Subject: Re: Telnet via CGI?
Message-Id: <7namju$vi6$1@nnrp1.deja.com>

You can use Comm.pl module. This comes with samlpe
code - how to telnet into remote machine via a
script. It uses "expect" commands to do this.
Harish M.

In article <7n6qdn$nl6$1@nnrp1.deja.com>,
  johnwingfield@my-deja.com wrote:
> I am trying to find a CGI script that will
> provide telnet access to a Unix machine.  I need
> to communicate with this machine across the
> firewall of someone ele's network, but have full
> access to the web via a proxy.  It should, in
> theory, be possible to write such a script, but
I
> know of no-one who has.
>
> Can anyone make any suggestions?
>
> Thanks,
>
> John Wingfield
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>



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


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

Date: 23 Jul 1999 21:33:47 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Testing a file to see if it's already open
Message-Id: <7nan3r$1tk$1@lublin.zrz.tu-berlin.de>

 <jjanssen3894@my-deja.com> wrote in comp.lang.perl.misc:
>This is not really a locking problem, but let me explain it properly.

It is also not really a perl problem.

[snippage]

>Is it possible, somehow, in Unix to see if someone else has a
>particular file open?  I would like to make it simple so that the FTP
>user doesn't have to do anything fancy, just my process will be smart
>enough to wait for them to be done downloading.

Check if your system has fuser.  In its absence, you'll have to resort
to a pragmatic solution, such as checking the files modification date.
If it's sufficiently old, assume the file is complete.

Anno


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

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

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


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