[13993] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1403 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 17 03:08:54 1999

Date: Wed, 17 Nov 1999 00:05:14 -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: <942825913-v9-i1403@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 17 Nov 1999     Volume: 9 Number: 1403

Today's topics:
    Re: /o in regexp with mod_perl lee.lindley@bigfoot.com
        about line sort ? <factory@factory.co.kr>
    Re: about line sort ? <wyzelli@yahoo.com>
    Re: about line sort ? <lr@hpl.hp.com>
    Re: about line sort ? <lr@hpl.hp.com>
    Re: Date & Time (Abigail)
    Re: Date & Time <uri@sysarch.com>
    Re: Date & Time (Martien Verbruggen)
    Re: Date & Time (Abigail)
    Re: Date & Time <uri@sysarch.com>
    Re: Date & Time <wyzelli@yahoo.com>
    Re: Fetch Dilbert. <uri@sysarch.com>
    Re: Fetch Dilbert. <uri@sysarch.com>
    Re: Fetch Dilbert. (Martien Verbruggen)
        foreach on a hash within a hash <curtisj@BannerFusion.com>
    Re: foreach on a hash within a hash <jkline@one.net>
    Re: foreach on a hash within a hash <jkline@one.net>
    Re: foreach on a hash within a hash <mj.stevenson@auckland.ac.nz>
        IE and Frames <joe_durand.mapson@mailcity.com>
    Re: IE and Frames (Sam Holden)
    Re: Multiple page form (Alan Curry)
    Re: Need ODBC Driver for Rdb 6.0 <austinms@worldnet.att.net>
    Re: Need ODBC Driver for Rdb 6.0 <eugen@svzserv.kemerovo.su>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 17 Nov 1999 05:48:25 GMT
From: lee.lindley@bigfoot.com
Subject: Re: /o in regexp with mod_perl
Message-Id: <80tfj9$a62$1@rguxd.viasystems.com>

Kragen Sitaker <kragen@dnaco.net> wrote:
:>In article <MPG.129b18d3e568570b98987f@nntp1.ba.best.com>,
:>Bill Moseley  <moseley@best.com> wrote:
:>>I see that placing /o there is wrong.  But placing it where I should 
:>>place it doesn't work under mod_perl -- so back to my original problem.

:>Maybe if you're using qr// to explicitly control when the pattern gets
:>compiled, you shouldn't be using /o anywhere.  Just a guess.

Kragen's "guess" is correct to my understanding.  Bill, please go
back and read what I wrote earlier in the thread again.  You do not
need /o anywhere in the code you have shown.

use re 'debug';
for ('this|that', 'another|some other') {
	$re = qr{($_)};	# Compiled each time this line is executed
	for ("this is another fine mess", "that is some other guy") {
		print "true for $1\n" if /$re/; # NEVER COMPILED HERE !!!!!
		# It was compiled when the assignment was made!
	}
}
__END__
true for this
true for that
true for another
true for some other

## Here are the "compiling RE" lines from stderr
compiling RE `(this|that)'
compiling RE `(another|some other)'

That's it.  No extra recompiles when $re is used in /$re/.
You don't need the /o!

I say again, put "use re 'debug'" in your program and see for yourself.

The reason I've been so persistent in answering this is that the
documentation is not clear.  I had the same questions Bill
had until I looked at some cases with "use re 'debug'".  I am not
absolutely certain about this though and would really appreciate
some confirmation.  Although the fact that nobody has seen fit
to jump me for posting wrong information almost speaks for
itself.  

Anybody care to guess how many compiles occur with the following?

use re 'debug';
$re1 = qr{this};
$re2 = qr{that};
$x = 'another';
for ("this is another fine mess", "that is some other guy") {
	print "true for $1\n" if /($re1|$re2|$x)/; 
	$x = 'other';
}

Now comment out the line "$x = 'other'" and check the results again.
When did that optimization get added?  I haven't yet checked to
see if that optimization is done when there aren't any compiled
re's in the m//.

Am I misinterpreting what I see from "use re 'debug'"?


-- 
// Lee.Lindley   /// I used to think that being right was everything.
// @bigfoot.com  ///  Then I matured into the realization that getting
////////////////////   along was more important.  Except on usenet.


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

Date: Wed, 17 Nov 1999 11:58:18 +0900
From: "Moltimer" <factory@factory.co.kr>
Subject: about line sort ?
Message-Id: <m47ATXKM$GA.162@news.thrunet.com>

Hi,

I'm trying to print out a html page.
and it works well with something like following code.
it prints all lines which has "sample" on second value.
Now, How can I sort all lines according to "$ex3" and print them in a html
page with correct order ?

The data lines are in data.txt.
$category = "sample";
open(FILE1, ">$category.html") || die "I can't ....\n";
flock (FILE1, 2) or die "can't lock ...\n";

open(FILE, "data.txt") || die "I can't open ..\n";
flock (FILE, 1) or die "can't ...\n";
   @lines = <FILE>;
close(FILE);
   $sizelines = @lines;

open(FILE, "<data.txt") || die "I can't ..\n";
flock (FILE, 2) or die "can't lock ...\n";
   chop;
   for ($a = 0; $a <= $sizelines; $a++) {
      $_ = $lines[$a];
      $line = $_;
      $line =~ s/\cM//g;
      $line =~ s/\n//g;
      ($ex0, $ex1, $ex2, $ex3) = split(/&&/, "$line");
      if($category eq "$ex1")

        print FILE1 qq~ $ex0 - $ex1 - $ex2 - $ex3 ~;
      }
   }
close(FILE);
close(FILE1);




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

Date: Wed, 17 Nov 1999 12:59:37 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: about line sort ?
Message-Id: <BipY3.6$Pp4.3025@vic.nntp.telstra.net>

Moltimer <factory@factory.co.kr> wrote in message
news:m47ATXKM$GA.162@news.thrunet.com...
> Hi,
>
> I'm trying to print out a html page.
> and it works well with something like following code.
> it prints all lines which has "sample" on second value.
> Now, How can I sort all lines according to "$ex3" and print them in a html
> page with correct order ?
>
> The data lines are in data.txt.
> $category = "sample";
> open(FILE1, ">$category.html") || die "I can't ....\n";
> flock (FILE1, 2) or die "can't lock ...\n";
>
> open(FILE, "data.txt") || die "I can't open ..\n";
> flock (FILE, 1) or die "can't ...\n";
>    @lines = <FILE>;
> close(FILE);
>    $sizelines = @lines;
>
> open(FILE, "<data.txt") || die "I can't ..\n";
> flock (FILE, 2) or die "can't lock ...\n";
Why are you opening the file in read mode that you have already read?

>    chop;
What are you chopping here?  chomp is safer in any event.

>    for ($a = 0; $a <= $sizelines; $a++) {
>       $_ = $lines[$a];
>       $line = $_;
how about $line = $lines[$a];

>       $line =~ s/\cM//g;
>       $line =~ s/\n//g;
Maybe you should have done a chomp $line after assigning it above?

>       ($ex0, $ex1, $ex2, $ex3) = split(/&&/, "$line");
>       if($category eq "$ex1")
>
>         print FILE1 qq~ $ex0 - $ex1 - $ex2 - $ex3 ~;
>       }
>    }
> close(FILE);
> close(FILE1);
>
>

Here is one way to achieve what you want, without making too many changes to
your existing code ....

$category = "sample";
open(FILE1, ">$category.html") || die "I can't ....\n";
flock (FILE1, 2) or die "can't lock ...\n";

open(FILE, "data.txt") || die "I can't open ..\n";
flock (FILE, 1) or die "can't ...\n";
@lines = <FILE>;
close(FILE);
$sizelines = @lines;
for ($a = 0; $a <= $sizelines; $a++) {
 $line = $lines[$a];
 $line =~ s/\cM//g;
 $line =~ s/\n//g;
 ($ex0, $ex1, $ex2, $ex3) = split(/&&/, "$line");
 if($category eq "$ex1"){
  $lineout = qq~ $ex0 - $ex1 - $ex2 - $ex3 ~;
  $sorted{$ex3} = $lineout;
 }
}
foreach $ex3 (sort keys %sorted){
 print FILE1 "$sorted{$ex3}\n";
}

close(FILE);
close(FILE1);

You could probably run a foreach look to assign $lines too but I am feeling
a little lazy.

Wyzelli




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

Date: Tue, 16 Nov 1999 19:39:02 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: about line sort ?
Message-Id: <MPG.129bc3313a422f4f98a218@nntp.hpl.hp.com>

In article <m47ATXKM$GA.162@news.thrunet.com> on Wed, 17 Nov 1999 
11:58:18 +0900, Moltimer <factory@factory.co.kr> says... 
> I'm trying to print out a html page.
> and it works well with something like following code.

Well, the code you show is garbled, but let's see anyway...

> it prints all lines which has "sample" on second value.
> Now, How can I sort all lines according to "$ex3" and print them in a html
> page with correct order ?
> 
> The data lines are in data.txt.
> $category = "sample";
> open(FILE1, ">$category.html") || die "I can't ....\n";
> flock (FILE1, 2) or die "can't lock ...\n";

Good, but include $! in each such diagnostic, so Perl can tell you more 
details about what went wrong.  And use the '-w' flag and 'use strict;' 
to help prevent other errors.

Also, see `perldoc -f flock` for how to import constants instead of that 
2 here and 1 below.

> open(FILE, "data.txt") || die "I can't open ..\n";
> flock (FILE, 1) or die "can't ...\n";
>    @lines = <FILE>;
> close(FILE);
>    $sizelines = @lines;
> 
> open(FILE, "<data.txt") || die "I can't ..\n";
> flock (FILE, 2) or die "can't lock ...\n";

The two lines above look rather like hiccups from somewhere.

>    chop;

This should be 'chomp;', and it should be within the line-processing 
loop, not here.  But it isn't necessary, because you strip out newlines 
later.

>    for ($a = 0; $a <= $sizelines; $a++) {
>       $_ = $lines[$a];

That all could be written in Perl, not C, this way:

     for (@lines) {

In fact, to avoid having all the file in memory at once, the file could 
be read here:

     while (<FILE>) {

>       $line = $_;
>       $line =~ s/\cM//g;
>       $line =~ s/\n//g;

Let's leave the input in $_, and do these changes nicer:

        tr/\cM\n//d;

>       ($ex0, $ex1, $ex2, $ex3) = split(/&&/, "$line");

The quotes around $line are superfluous and misleading.  Anyway, the 
input is now in $_.

        my @ex = split /&&/;

>       if($category eq "$ex1")
>         print FILE1 qq~ $ex0 - $ex1 - $ex2 - $ex3 ~;

I think you want to have a newline back on those outputs.

>       }

Now we're not ready to print the lines, because they aren't sorted.  So 
let's save them, already split up for sorting:

        push @ex1_lines, \@ex if $category eq $ex[1];

>    }
> close(FILE);

Now we are ready to sort, which in this case is easy.  Read all about it 
in perlfaq4: "How do I sort an array by [anything]?"

I'll do it all in one line for fun.

      print FILE1 map { (" ", join(' - ' => @$_), " \n") }
                 sort { $a->[3] cmp $b->[3] } @ex1_lines;

> close(FILE1);

Phew!

Here's a little file that I used to test the stuff above.

Enjoy!


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

my $category = "sample";
my @ex1_lines;

while (<DATA>) {
    tr/\cM\n//d; # Probably just 'chomp;' here is better!
    my @ex = split /&&/;
    push @ex1_lines, \@ex if $category eq $ex[1];
}

print map { (" ", join(' - ' => @$_), " \n") }
     sort { $a->[3] cmp $b->[3] } @ex1_lines;

__END__
foo&&sample&&bar&&xxx
foo&&Sample&&bar&&xxx
foo&&sample&&bar&&aaa
foo&&Sample&&bar&&xxx
foo&&sample&&bar&&mmm

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


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

Date: Tue, 16 Nov 1999 23:38:33 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: about line sort ?
Message-Id: <MPG.129bfb4b9cd1f0d798a21a@nntp.hpl.hp.com>

In article <BipY3.6$Pp4.3025@vic.nntp.telstra.net> on Wed, 17 Nov 1999 
12:59:37 +0930, Wyzelli <wyzelli@yahoo.com> says...

 ...

>  ($ex0, $ex1, $ex2, $ex3) = split(/&&/, "$line");
>  if($category eq "$ex1"){
>   $lineout = qq~ $ex0 - $ex1 - $ex2 - $ex3 ~;
>   $sorted{$ex3} = $lineout;
>  }
> }
> foreach $ex3 (sort keys %sorted){
>  print FILE1 "$sorted{$ex3}\n";
> }

I didn't see any indication that the keys $ex3 were unique.  If they 
aren't, you will lose data with this approach.

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


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

Date: 16 Nov 1999 20:39:19 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Date & Time
Message-Id: <slrn8345h5.cvu.abigail@alexandra.delanet.com>

Trevor Barnett (Zephyre@home.com) wrote on MMCCLXIX September MCMXCIII in
<URL:news:ZmnY3.722$lY5.6761@news.rdc1.nj.home.com>:
"" Hello. I need to create a script that catches the date and time of the
"" SERVER. I think this would be simple but I can't figure out the command to
"" do it. Could someone help me out?


    #!/opt/perl/bin/perl -w

    use strict;
    use Socket;

    local *DATE;

    my $SERVER = "your.server.com";
    my $port   =  getservbyname daytime => 'tcp';

    socket  DATE, PF_INET, SOCK_STREAM, getprotobyname 'tcp' or die "Socket!";
    connect DATE, sockaddr_in $port => inet_aton $SERVER     or die "Connect!";

    my $date = <DATE>;
    print $date;

    __END__


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: 17 Nov 1999 00:07:08 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Date & Time
Message-Id: <x7g0y5u2o3.fsf@home.sysarch.com>

>>>>> "A" == Abigail  <abigail@delanet.com> writes:

  A>     local *DATE;

does that local do anything? it is at the top level so it can't hide any
previous values of *DATE

  A>     socket  DATE, PF_INET, SOCK_STREAM, getprotobyname 'tcp' or die
  A>     "Socket!";

  A>     connect DATE, sockaddr_in $port => inet_aton $SERVER     or die
  A>     "Connect!";

this is where IO::Socket is nice to use (who wants to mess with the
low level socket data?):

	use IO::Socket ;

	$date_sock = IO::Socket::INET->new( "yourserver.com:daytime") ;
	print <$s> ;

error handling is left as an exercise to the reader.

or as a oneliner:

perl -MIO::Socket -e '$s=IO::Socket::INET->new("localhost:daytime"); print <$s>'

or in one statement:

perl -MIO::Socket -e 'print IO::Socket::INET->new("localhost:daytime")->getline'

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Wed, 17 Nov 1999 05:43:16 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: Date & Time
Message-Id: <slrn834g3k.fbm.mgjv@verbruggen.comdyn.com.au>

On 16 Nov 1999 20:39:19 -0600,
	Abigail <abigail@delanet.com> wrote:

>     my $SERVER = "your.server.com";

my server is your server? My... how friendly of you :)

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 16 Nov 1999 23:52:09 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Date & Time
Message-Id: <slrn834gqn.cvu.abigail@alexandra.delanet.com>

Uri Guttman (uri@sysarch.com) wrote on MMCCLXIX September MCMXCIII in
<URL:news:x7g0y5u2o3.fsf@home.sysarch.com>:
// >>>>> "A" == Abigail  <abigail@delanet.com> writes:
// 
//   A>     local *DATE;
// 
// does that local do anything? it is at the top level so it can't hide any
// previous values of *DATE

It doesn't hurt, and it's a good habit.

//   A>     socket  DATE, PF_INET, SOCK_STREAM, getprotobyname 'tcp' or die
//   A>     "Socket!";
// 
//   A>     connect DATE, sockaddr_in $port => inet_aton $SERVER     or die
//   A>     "Connect!";
// 
// this is where IO::Socket is nice to use (who wants to mess with the
// low level socket data?):

The difference is, 'man socket' gives you all you need to know on the
first page, 'man IO::Socket' doesn't. In fact, you've to look up more man
pages. I dislike anything in the IO::*, HTTP::*, and URI::* hierarchies.
Too many manpages to consult to actually be able to do anything.



Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


  -----------== 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: 17 Nov 1999 00:59:04 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Date & Time
Message-Id: <x7d7t9u09j.fsf@home.sysarch.com>

>>>>> "A" == Abigail  <abigail@delanet.com> writes:

  A> // this is where IO::Socket is nice to use (who wants to mess with the
  A> // low level socket data?):

  A> The difference is, 'man socket' gives you all you need to know on the
  A> first page, 'man IO::Socket' doesn't. In fact, you've to look up more man
  A> pages. I dislike anything in the IO::*, HTTP::*, and URI::* hierarchies.
  A> Too many manpages to consult to actually be able to do anything.

aw, come abigail, scared to rtfm? :-) remembering all the getprotobyname
stuff in the right argument order is much more work than the simple
host:port syntax of IO::Socket::INET. i didn't look anything up for that
other than getline (in IO::Handle) since i never use that and needed to
know the method.

i can't recall ever using anything in URI::* (hey it's name after me, i
shoul dknow it) and i rarely use anything in HTML::*. IO::* i use in
some cases for its object approach or shortness of code as with the
connect example i posted. can't beat a one statement command line
client.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Wed, 17 Nov 1999 16:10:24 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Date & Time
Message-Id: <v5sY3.16$Pp4.3664@vic.nntp.telstra.net>

Martien Verbruggen <mgjv@verbruggen.comdyn.com.au> wrote in message
news:slrn834g3k.fbm.mgjv@verbruggen.comdyn.com.au...
> On 16 Nov 1999 20:39:19 -0600,
> Abigail <abigail@delanet.com> wrote:
>
> >     my $SERVER = "your.server.com";
>
> my server is your server? My... how friendly of you :)
>
> Martien

Till death us do part?

heh

Wyzelli




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

Date: 16 Nov 1999 23:44:43 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Fetch Dilbert.
Message-Id: <x7n1sdu3pg.fsf@home.sysarch.com>

>>>>> "A" == Abigail  <abigail@delanet.com> writes:

  A> open  DISPLAY,  "| $viewer"                 or die "Failed to open viewer.\n";
  A> print DISPLAY      $image;
  A> close DISPLAY                               or die "Failed to close viewer.\n";

i dunno about you, but i don't want to spawn a full viewer for each
image. hence my version is a cgi program which generates the html for
use by a browser. also it shows a month at a time (but could easily be
hacked to one day only) and handles the 'hidden' gif address problem
(which yours does too).

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 16 Nov 1999 23:50:04 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Fetch Dilbert.
Message-Id: <x7k8nhu3gj.fsf@home.sysarch.com>

>>>>> "p" == perldoc  <perldoc@my-deja.com> writes:

  p> Gee, is it any surprise this group is overloaded with
  p> confused newbies?  Thanks for adding to the confusion
  p> by providing a link to *your* buggy code.

and it is infested with assholes who don't help with anything and hide
behind stupid nicks. your using perldoc is doubly moronic as you don't
know perl docs nor are you a perl doctor.

  p> print "Just another self-promoter,"

just another perl jerk.

  p> Yours,  perldoc
  p> .signature containing 4-line advertisement omitted

hiding behind no signature nor real name. how brave! how strong! 

i bet this is the twit who recently said he would come back and we
wouldn't know it. but of course he can't admit that now or he would be
wrong in that prediction. and he is too ashemed to show his face anyhow.

go away. you are worse than all the confused newbies in a barrel.

uri (proudly showing his name and promoting himself in a legitimate 4
line .sig. too bad you can't do that.)

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Wed, 17 Nov 1999 05:48:56 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: Fetch Dilbert.
Message-Id: <slrn834ge8.fbm.mgjv@verbruggen.comdyn.com.au>

On 16 Nov 1999 23:50:04 -0500,
	Uri Guttman <uri@sysarch.com> wrote:

> hiding behind no signature nor real name. how brave! how strong! 
> 
> i bet this is the twit who recently said he would come back and we
> wouldn't know it. but of course he can't admit that now or he would be
> wrong in that prediction. and he is too ashemed to show his face anyhow.

I think you're right. The style is very similar.

From my score file:
%   From: "George Jempty" <jb4mt@verbatims.com>
% Ranted illogically about Abigail. Does not know what
% spam is. Needs a LART: clueless Usenet abuser
	From: jb4mt@verbatims\.com

Looks like the abuse is continuing.

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Wed, 17 Nov 1999 03:32:07 GMT
From: Curtis Jones <curtisj@BannerFusion.com>
Subject: foreach on a hash within a hash
Message-Id: <80t7jo$3kl$1@nnrp1.deja.com>

What is the best way to go about retrieving a list of the values of a
hash within a hash?

If I simply have a hash,

%hash;
$hash{'one'};
$hash{'two'};
$hash{'three'};

I can do a:

foreach ( sort keys %hash ) ...

to retrieve each of the values in it, but I can't seem to figure out how
to do that to a hash that is within a hash...or deeper.

Thanks for any help.

-Curtis


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


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

Date: Tue, 16 Nov 1999 23:19:07 -0500
From: Joe Kline <jkline@one.net>
To: Curtis Jones <curtisj@BannerFusion.com>
Subject: Re: foreach on a hash within a hash
Message-Id: <38322CBB.40DD7496@one.net>

[cc'd and posted]

Curtis Jones wrote:
> 
> What is the best way to go about retrieving a list of the values of a
> hash within a hash?
> 
> If I simply have a hash,
> 
> %hash;
> $hash{'one'};
> $hash{'two'};
> $hash{'three'};
> 
> I can do a:
> 
> foreach ( sort keys %hash ) ...
> <SNIP>

Hmmm....a good place to start is 'perldoc perldsc' or 'perldoc
perlref' or 'perldoc perllol' or 'perldoc perldata' there's tons of
useful documentation just sitting on your computer that comes with
every installation of Perl.

But to promote the general welfare, secure the common defense, and
insure domestic tranquility I'll even throw in a few examples.

Example 1:

my (%hoh, $k1, $v1, $k2, $v2);

K1:foreach $k1 ( keys %hoh )
{
    $v1 = $hoh{$k1}; # kinda silly since you'll get a HASHREF

    K2:foreach $k2 ( keys ${ $hoh{$k1} } )
    {
        $v2 = $hoh{$k1}{$k2};
    } # K2
} # K1

Example 2:

Uri enlightened me to this method.

my ( %hoh, $k1, $v1, $k2, $v2);
K1:while( ($k1, $v1) = each %hoh )
{
    # once again $v1 is a HASHREF
    # but we make better use of it
    K2:while( ($k2, $v2) = each %{ $v1 } )
    {
        # do that voodoo that you do
    } # K2
} # K1


Example 1 can use 'sort' to go through the keys in a specific order.
Example 1 just runs through the hash and spits them out whatever order
the hashing algorithm puts them. I don't think you can pull them out
in sorted orded.

joe


  -----------== 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: Tue, 16 Nov 1999 23:20:52 -0500
From: Joe Kline <jkline@one.net>
Subject: Re: foreach on a hash within a hash
Message-Id: <38322D24.E602815E@one.net>



Joe Kline wrote:
> 
> <SNIP>
> Example 1:
> 
> my (%hoh, $k1, $v1, $k2, $v2);
> 
> K1:foreach $k1 ( keys %hoh )
> {
>     $v1 = $hoh{$k1}; # kinda silly since you'll get a HASHREF
> 
>     K2:foreach $k2 ( keys ${ $hoh{$k1} } )
                           ^^^ should be %

>     {
>         $v2 = $hoh{$k1}{$k2};
>     } # K2
> } # K1

I need to fire my proofreader.

joe


  -----------== 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: Wed, 17 Nov 1999 17:32:54 +1300
From: Matthew Stevenson <mj.stevenson@auckland.ac.nz>
Subject: Re: foreach on a hash within a hash
Message-Id: <38322FF6.92A3CE51@auckland.ac.nz>

Curtis Jones wrote:
> 
> What is the best way to go about retrieving a list of the values of a
> hash within a hash?

an example probably is easiest so...

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

my $myhash;
$myhash->{'key1'}{'key2'}='value1';

print keys %$myhash,"\n";
print keys %{$myhash->{'key1'}},"\n";
print $myhash->{'key1'}{'key2'},"\n";

output is ...

key1
key2
value1

Is there a better way?

Matthew
-- 

Matthew Stevenson
University of Auckland
mj.stevenson@auckland.ac.nz


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

Date: Tue, 16 Nov 1999 19:52:55 -0800
From: Joseph Durand <joe_durand.mapson@mailcity.com>
Subject: IE and Frames
Message-Id: <38322697.109AF3E2@mailcity.com>

I have a defined a frameset with a top and bottom frame.  Submitting the
form on top causes the result to be displayed on the bottom.

print "Window-target: bottom\n";
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<BODY>\n";
print "FooBar\n";
print "</BODY>\n";
print "</HTML>\n";

This works perfectly on Netscape Navigator (and is explained in item
3.15 of the FAQ), but does not seem to work with IE4.  It persists in
displaying in the top frame.  Is there some way to force the output to
display in the bottom window for IE or do I have to dump my use of
frames here?

TIA,

Joe Durand
_____________________________________________________________________
Note: remove  .mapson to use my email address





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

Date: 17 Nov 1999 04:00:51 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: IE and Frames
Message-Id: <slrn834a43.3ke.sholden@pgrad.cs.usyd.edu.au>

On Tue, 16 Nov 1999 19:52:55 -0800,
	Joseph Durand <joe_durand.mapson@mailcity.com> wrote:
>I have a defined a frameset with a top and bottom frame.  Submitting the
>form on top causes the result to be displayed on the bottom.
>
>print "Window-target: bottom\n";
>print "Content-type: text/html\n\n";
>print "<HTML>\n";
>print "<BODY>\n";
>print "FooBar\n";
>print "</BODY>\n";
>print "</HTML>\n";
>
>This works perfectly on Netscape Navigator (and is explained in item
>3.15 of the FAQ), but does not seem to work with IE4.  It persists in
>displaying in the top frame.  Is there some way to force the output to
>display in the bottom window for IE or do I have to dump my use of
>frames here?

This has nothing to do with perl...

You shoulb be looking in the comp.infosystems.www.* groups.


-- 
Sam

You can write Perl programs that resemble sed, or awk, or C, or Lisp, or
Python. This is Officially Okay in Perl culture.
	--Larry Wall


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

Date: Wed, 17 Nov 1999 04:48:37 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Multiple page form
Message-Id: <FsqY3.20762$YI2.902179@typ11.nn.bcandid.com>

In article <slrn83426h.cvu.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:
>Since HTTP is a stateless protocol, you'll have to use some other
>protocol to maintain state.

I'm waiting for someone to solve this problem once and for all with an
IP-over-HTTP RFC.

  ifconfig http0 10.0.0.1 peer www.example.com/ip.cgi
-- 
Alan Curry    |Declaration of   | _../\. ./\.._     ____.    ____.
pacman@cqc.com|bigotries (should| [    | |    ]    /    _>  /    _>
--------------+save some time): |  \__/   \__/     \___:    \___:
 Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman


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

Date: Tue, 16 Nov 1999 22:59:10 -0500
From: Michael Austin <austinms@worldnet.att.net>
Subject: Re: Need ODBC Driver for Rdb 6.0
Message-Id: <3832280E.B7FCB8D1@worldnet.att.net>

There is always the SQL/SERVICES API.  In fact it is faster and more flexible
than  ODBC.  If you are using Rdb 7.0+ you can use SQL*Net.


Michael Austin
Michael Austin, Inc.
A DBA Consulting Firm.
michaelaustininc@hotmail.com


Eugene Grosbein wrote:

> > The only way I can see you achieving this connectivity is via a Win32
> > Gateway machine if you can obtain a Win32 ODBC Driver for RDB which I
> > do believe is bundled with it.
>
> Yes, it works. Really, I get data from Rdb exactly in this way now :)
> But, my goal is to exclude that Windows NT machine from the chain.
>
> >
> > You could than use our FreeBSD ODBC client, ODBC agent for Win32 and
> > Rdb Win32 ODBC Driver to connect to the Rdb server. Please view the
> > folowing URL for details onhow to use our ODBC agent:
> >
> > http://www.openlinksw.com/info/docs/rel3doc/unix/odbcsdk.htm
>
> I tried iODBC, OpenLink Request Broker - nothing supports Rdb 6.0.
> OpenLink Request Broker is a great thing, it could be perfect solution.
> Does anybody know, are there any plans to include Rdb support to
> OpenLink Request Broker?
>
> Cannot be true that there is no way to connect to VAX/Rdb from UNIX without
> using WIN32!
>
> Eugene Grosbein



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

Date: Wed, 17 Nov 1999 12:32:40 +0800
From: Eugene Grosbein <eugen@svzserv.kemerovo.su>
To: austinms@worldnet.att.net
Subject: Re: Need ODBC Driver for Rdb 6.0
Message-Id: <38322FE8.988075E1@svzserv.kemerovo.su>

> > > The only way I can see you achieving this connectivity is via a Win32
> > > Gateway machine if you can obtain a Win32 ODBC Driver for RDB which I
> > > do believe is bundled with it.
> >
> > Yes, it works. Really, I get data from Rdb exactly in this way now :)
> > But, my goal is to exclude that Windows NT machine from the chain.

> > I tried iODBC, OpenLink Request Broker - nothing supports Rdb 6.0.
> > OpenLink Request Broker is a great thing, it could be perfect solution.
> > Does anybody know, are there any plans to include Rdb support to
> > OpenLink Request Broker?
> >
> > Cannot be true that there is no way to connect to VAX/Rdb from UNIX without
> > using WIN32!

> 
> There is always the SQL/SERVICES API.  In fact it is faster and more flexible
> than  ODBC.  If you are using Rdb 7.0+ you can use SQL*Net.
> 

I use Oracle Rdb 6.0 (aka Dec Rdb). 
Can I connect to Rdb from Perl program via SQL*Net?
If so, what module do I need?
Client  platform is FreeBSD, server is VAX/OpenVMS 6.1

Eugene Grosbein


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

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


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