[21851] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4055 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 1 06:06:21 2002

Date: Fri, 1 Nov 2002 03:05:09 -0800 (PST)
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, 1 Nov 2002     Volume: 10 Number: 4055

Today's topics:
    Re: 2 different results from while loop... <parv_fm@emailgroupsWhereElse.com>
    Re: can_write and tcp connect question <goldbb2@earthlink.net>
    Re: Declaring 2 Dimensional Hashes <jurgenex@hotmail.com>
    Re: Declaring 2 Dimensional Hashes <steven.smolinski@sympatico.ca>
    Re: Declaring 2 Dimensional Hashes <jkeen@concentric.net>
    Re: Declaring 2 Dimensional Hashes <hal@thresholddigital.com>
    Re: Declaring 2 Dimensional Hashes <hal@thresholddigital.com>
    Re: Declaring 2 Dimensional Hashes <hal@thresholddigital.com>
    Re: Declaring 2 Dimensional Hashes <goldbb2@earthlink.net>
        fill array with equal elements <pilsl_use@goldfisch.at>
    Re: how to share socket handle across related  process <noorix@yahoo.com>
    Re: I need help with a regular expression in perl <garry@ifr.zvolve.net>
    Re: Limit output of examine (x) and return (r) in debug <nospam-abuse@ilyaz.org>
    Re: pass a parameter in win32? (jim ryan)
    Re: problem with hash content disappearing - unable to  <jkeen@concentric.net>
    Re: problem with hash content disappearing - unable to  (Jay Tilton)
        Question about changing variables in URL <buck@buck.buck>
        Search for a string while in PerlDoc? <ryan@jimryan.com>
    Re: Why is this an infine loop??? <nobull@mail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 01 Nov 2002 08:04:46 GMT
From: parv <parv_fm@emailgroupsWhereElse.com>
Subject: Re: 2 different results from while loop...
Message-Id: <slrnas4dj9.1o7r.parv_fm@localhost.holy.cow>

in message <k2nw9.43155$iV1.38768@nwrddc02.gnilink.net>,
wrote Jürgen Exner ...

> havoc wrote:
>> Okay, I got a text file that looks like this:
>>
>> -----
>> 1                 #id number
>> SomeUser          #username
>> SomeUser's Info   #info on someuser
>> -----
>> 2
>> OtherUser
>> OtherUsers Info
 ...
>>
>> open(FILE,"somefile.txt");
>> while(<FILE>){
>>  my $id   = <FILE>;
>>  my $name = <FILE>;
>>  my $info = <FILE>;
>>
>>  print "Info on $name (ID: $id) - $info";
>> }
>> close(FILE);
>>
> That is a dirty programming trick:
> The "while (<FILE>)" reads a line, too. And this happens to be the
> line containing the dashes.
> 
> This is not what I call error-tolerant programming and the
> programmer who did that would not have passed my class.

would using next & seek be any better?  below is pseudocode

 - loop until end of the file
     - skip current line if it matches "^-{5}$"
     - else,
         store current line in $id
         seek next line; store it in $name
         seek next line; store it in $info


  - parv

-- 

  please don't send me private e-mail.
  if you must, do away w/ WhereElse in the address.


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

Date: Fri, 01 Nov 2002 00:51:29 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: can_write and tcp connect question
Message-Id: <3DC21661.697FA992@earthlink.net>

smackdab wrote:
> 
> I am connecting to a few TCP sockets and then I am doing a can_write()
> on the my $select object...
> 
> I want to see if there is any connect text. (ie: welcome FTP, or IIS
> web server, etc.)

You should read the documentation for those protocols.

For example, if you want to learn whether there's any connect text when
you connect to an ftp server, you might try:
   http://www.google.com/search?&q=ftp+rfc
And then pick a page.

Presumably, IIS web servers implement the HTTP protocol, so:
   http://www.google.com/search?&q=http+rfc

> So, I do a: $sock->sysread($buf, 1024);
> 
> On my linux box, I get some text from the SSH port, but the FTP
> doesn't show any text.
> 
> But both of them *seem* to show text in my Win2K network packet
> monitor...

I cannot comment on why you are/aren't getting data in the responses,
but I can say, it's perfectly valid to recieve TCP packets which don't
contain any data in them, for various and sundry reasons -- read the
rfcs on the TCP protocol to learn more.

> If you connect to a valid TCP port, do they normally respond with a
> connect string?

That depends on what protocol is being run on the other end.

> Is this the correct way to grab that text?

Yes, sysread is the right way to do it, if there is any text to grab.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: Fri, 01 Nov 2002 05:27:45 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Declaring 2 Dimensional Hashes
Message-Id: <lhow9.21427$FS5.12057@nwrddc04.gnilink.net>

Hal Vaughan wrote:
> I know I can delcare a hash with:
>
> my (%myhash);
>
> but what how do I declare a 2 dimensional hash, one I can reference
> like this:

Perl hashes (and arrays for that matter) are only one dimensional.
The values are always a scalars, never hashes or arrays.

Having said that of course you can have a hash of references (which are
scalars, too) which in turn point to other hashes.

For further details please see "perldoc perlref".

jue




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

Date: Fri, 01 Nov 2002 05:30:48 GMT
From: Steven Smolinski <steven.smolinski@sympatico.ca>
Subject: Re: Declaring 2 Dimensional Hashes
Message-Id: <ckow9.12264$Nf2.1293236@news20.bellglobal.com>

Jürgen Exner <jurgenex@hotmail.com> wrote:
> Hal Vaughan wrote:
>> I know I can delcare a hash with:
>>
>> my (%myhash);
>>
>> but what how do I declare a 2 dimensional hash, one I can reference
>> like this:
> 
[...]
> For further details please see "perldoc perlref".

And man perldsc, The Data Structures Cookbook, contains lots of examples
for a HoH, which is what you are using.

Steve


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

Date: 01 Nov 2002 05:38:10 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Re: Declaring 2 Dimensional Hashes
Message-Id: <apt402$n1l@dispatch.concentric.net>


"Hal Vaughan" <hal@thresholddigital.com> wrote in message
news:Ycnw9.188457$qM2.63904@sccrnsc02...
> I know I can delcare a hash with:
>
> my (%myhash);
>
> but what how do I declare a 2 dimensional hash, one I can reference like
> this:
>
> $myhash{$myvar1}{$myvar2}
>
> Is just declaring it like above enough for two or three dimensional
hashes,

Yes.

> or is there some way I need to specify it's a hash with two or more
> dimensions?
>

No.  Multiple dimensions only materialize once you start to assign values to
the hash.




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

Date: Fri, 01 Nov 2002 05:44:16 GMT
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Re: Declaring 2 Dimensional Hashes
Message-Id: <Dvow9.184191$md1.42142@sccrnsc03>

Steven Smolinski wrote:

> And man perldsc, The Data Structures Cookbook, contains lots of examples
> for a HoH, which is what you are using.

So it's not a 2 dimensional hash, but a hash of hashes?  I think I see.  
Thanks.  (I'm self taught -- I've never had any background on data 
structures and sometimes it can get a bit confusing.)

Thanks for the help.

Hal


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

Date: Fri, 01 Nov 2002 05:44:27 GMT
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Re: Declaring 2 Dimensional Hashes
Message-Id: <%wow9.197199$%d2.69642@sccrnsc01>

Jürgen Exner wrote:

> For further details please see "perldoc perlref".

Thanks.  Sometimes it's hard just trying to figure out which docs or manfile 
to check.  (I'm rapidly getting to the point where I wish I had at least 
minored in Computer Science at college.)

 
> jue



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

Date: Fri, 01 Nov 2002 05:46:32 GMT
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Re: Declaring 2 Dimensional Hashes
Message-Id: <qxow9.197208$%d2.69402@sccrnsc01>

James E Keenan wrote:

 
> No.  Multiple dimensions only materialize once you start to assign values
> to the hash.


Thanks!

Hal


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

Date: Fri, 01 Nov 2002 01:24:48 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Declaring 2 Dimensional Hashes
Message-Id: <3DC21E30.602124A6@earthlink.net>

Hal Vaughan wrote:
> 
> Steven Smolinski wrote:
> 
> > And man perldsc, The Data Structures Cookbook, contains lots of
> > examples for a HoH, which is what you are using.
> 
> So it's not a 2 dimensional hash, but a hash of hashes?

Close -- it's a hash of hashrefs.  But for most purposes, it acts like a
hash of hashes.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: Fri, 1 Nov 2002 12:04:36 +0100
From: peter pilsl <pilsl_use@goldfisch.at>
Subject: fill array with equal elements
Message-Id: <3dc25fe1$1@e-post.inode.at>


for building a database-test-suite I need to fill mediumsized arrays 
(1000-10000 elements) with equal values very often:

foreach (1..10000) {push(@array,$value);}

So this is very slow. I was thinking about alternatives, but all  I found 
are very slow (see my script below). 
Suprisingly the fastet way was to create a string using the 'x'-operator 
and then split it. So I'm quite sure there is a similar way for arrays and 
I just dont see it cause its one if these days.

thnx,
peter

my tested ways in short:

1) push each element in a loop
2) define each element in a loop  $array[$i]=$value;
3) create string and split 
4) push with pseudobinary approach
5) push with recursive binary approach

Suprisingly 3) was the fastest and 4) and 5) didnt win against 1) which 
indicates that pushing arrays to arrays is internaly solved as loop as well 
:)


results for create 1000 arrays with 2000 elements each:

testing method 1        (4.814597s)
testing method 2        (3.97396s)
testing method 3        (6.815278s)
testing method 4        (4.307844s)
testing method 5        (5.379027s)


#! /usr/bin/perl -w

use strict;
use Time::HiRes qw(gettimeofday tv_interval);

my $l=2000;  # size of array
my $n=1000;  # number of arrays to fill

$l=int($l/2)*2;  # recursive method only works with numbers of two

my @m; read_methods();

my $t0;
my $elapsed;

foreach (1..$#m) {       # iterate the methods
  print "testing method ".$_."\t";
  $t0 = [gettimeofday];
  foreach my $i (1..$n) {   
    my $x="hallo".$i;       # the value to fill with
    my $p=&{$m[$_]}($x);
    if ($#{@$p}+1 ne $l) {  # test if method returned correct array-size
      print $#{@$p}+1,"\n";
      die "not proper size";
    }
  }
  $elapsed = tv_interval ( $t0 );
  print "(",$elapsed,"s)\n";
  $t0 = [gettimeofday];
}

sub read_methods{
  
  $m[1]=sub{
    # just push
    my @a;
    my $x=shift;
    foreach my $j (1..$l) {
      push(@a,$x);
    }
    return \@a;
  };
    
  $m[2]=sub {
    my @a;
    my $x=shift;
    $x=$x.',';
    my $s=$x x $l;
    @a=split(/,/,$s);
    return \@a;
  };
  
  $m[3]=sub {
    # just define
    my @a;
    my $x=shift;
    foreach my $j (1..$l) {
      $a[$j-1]=$x;
    }
    return \@a;
  };

  $m[4]=sub {
    # pseudologarithmic approach
    my @a;
    my $x=shift;
    my $s=int(log($l)/log(2));
    @a=($x);
    
    foreach my $j (2..$s) {
      push(@a,@a);
    }
    foreach my $j ($#a+2..$l) {
      push(@a,$x);
    }
    return \@a;
  };

  $m[5]=sub {
    # real logarithmik approach
    my @a;
    my $x=shift;
    return m5_rec($x,$l);
  };
        
}

sub m5_rec{
  my @a;
  my $x=shift;
  my $l=shift;
  my $s=int(log($l)/log(2))+1;
  @a=($x);
  foreach my $j (2..$s) {
    push(@a,@a);
  }
  push(@a,@{m5_rec($x,$l-$#a-1)}) if $l-$#a-1>1;

  return \@a;
};




-- 
peter pilsl
pilsl_@goldfisch.at
http://www.goldfisch.at



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

Date: Fri, 1 Nov 2002 15:43:24 +0500
From: "Murtaza Nooruddin" <noorix@yahoo.com>
Subject: Re: how to share socket handle across related  process
Message-Id: <aptlru$4nbn1$1@ID-165850.news.dfncis.de>

Thankyou Stefan, but I cannot fork() after accepting a connection, and the
there has to be only 1 child (worker) process. Anyway I found the solution
to it. There is a poorly documented, but working module on CPAN,
File::FDPasser.


>"Stefan" <someone@somewhere.nl> wrote in message
news:3dc17004$0$84938$e4fe514c@dreader4.news.xs4all.nl...
> "Murtaza Nooruddin" <noorix@yahoo.com> schreef in bericht
> news:apr086$48rpl$1@ID-165850.news.dfncis.de...
> > I am having a hard time sharing a socket handle between parent and child
> > process.
> > The Parent is a listening socket, and accepts a new connection, and I
must
> > give this newly connected socket handle to the child process. Sharing it
> in
> > shared memory does work, IPC::Shareable says that it can't share GLOB
> > variables. I believe there is a way using /proc filesystem under linux,
> but
> > not sure how.
> >
> > Pleae help.
> >
>
> I presume you want to write a non-blocking TCP server. So in your main
> program you got
>
>      my $socket = IO::Socket::INET->new( ... )
>
> and after that in an (endless) loop
>
>      my $connection = $socket->accept();
>
> so that when you fork() a child process you can
>
>      in the main process
>         - close the connection
>         - continue the accept-loop
>
>      in the child process
>         - close the socket
>         - do whatever you like with the connection
>         - close the connection
>         - exit
>
> This is possible becaurse "File descriptors (and sometimes locks on those
> descriptors) are shared, while everything else is copied". See the
> description of fork() for more details.
>
> All this with the usual error checking, child reaping, etc, of course.
>
> Get more information using the command "perldoc perlipc" or on the net at
>
http://www.perldoc.com/perl5.8.0/pod/perlipc.html#Sockets--Client-Server-Com
> munication (www.perldoc.com  |  Perl Manpage  |  perlipc). You'll find
some
> good examples there.
>
> Good luck
> Stefan
>
>
>
>
>
>




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

Date: Fri, 01 Nov 2002 05:28:09 GMT
From: Garry Williams <garry@ifr.zvolve.net>
Subject: Re: I need help with a regular expression in perl
Message-Id: <slrnas43uo.9t6.garry@zfw.zvolve.net>

On 31 Oct 2002 17:13:15 -0800, Pularis <pularis@go.com> wrote:
> Can someone please tell me what the perl regular expresssion to find a
> string in a line which looks like XYZ0000000000 ( 3 alpahbets followed
> by 8 digits )

  /\b[A-Z]{3}\d{8}\b/

See perlre.  

-- 
Garry Williams


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

Date: Fri, 1 Nov 2002 05:17:22 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Limit output of examine (x) and return (r) in debugger.
Message-Id: <apt2p2$1okq$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Teh (tî'pô)
<teh@mindless.com>], who wrote in article <k2p1suo1oesajjcvff2keahe4e6nb8snvs@4ax.com>:
> >It should not.  I tried it with
> >
> >  x (0..10000)
> >
> >and it does not.  (Both 5.005_53 and 5.6.1 I have nearby.)

> You're right, when I test it on trivial samples (like your array and
> the nested hashes in my previous mail) I get my debugger prompt back.
> I don't know why this doesn't happen in my real life project.

Do you install $SIG{INT}?

Ilya



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

Date: 1 Nov 2002 02:31:05 -0800
From: ryan@jimryan.com (jim ryan)
Subject: Re: pass a parameter in win32?
Message-Id: <d220d0c9.0211010231.165a26ac@posting.google.com>

Thank you...


Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net> wrote in message news:<slrnas242s.rma.bernard.el-hagin@gdndev25.lido-tech>...
> In article <MPG.182ad7cb59e3908a989707@news1.news.adelphia.net>, Jim Ryan wrote:
> > How can I pass a parameter to my perl script at the command line in 
> > NT/2000?  What variable does it become?  Thanks in advance.
> 
> 
> perl perlscript.pl parameter
> 
> 
> 'parameter' becomes the first element of the special array @ARGV.
> 
> 
> Do
> 
> 
>   perldoc perlvar
> 
> 
> and search for @ARGV.
> 
> 
> Cheers,
> Bernard


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

Date: 01 Nov 2002 05:38:11 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Re: problem with hash content disappearing - unable to debug and find why - weird behavior
Message-Id: <apt403$n1f@dispatch.concentric.net>


"P.J Douillard" <pjdouillard@snclavalin.com> wrote in message
news:4f351142.0210311935.5dbb66db@posting.google.com...
> For starters, I'm using the latest ActivePerl, and I'm running it on
> W2K sp3.  And I'm kind of new to Perl.
>
[snip]
> NOTE: If you notice that I'm not using 'things' correctly, please, let
> me know.
>

I couldn't fully test your script because it contains two undefined
subroutines here:

    $tempLocalGroupName =
'L01'.&genLocalName($path).'01-'.&getSuffix($dirFile);

My initial impression is that your debugging problem may stem from the
length of the subroutine.  Consider breaking this down into several
component subroutines and testing each individually before combining them
into a larger structure.

Are you using Perl's native debugger or the ActivePerl debugger?




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

Date: Fri, 01 Nov 2002 07:00:18 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: problem with hash content disappearing - unable to debug and find why - weird behavior
Message-Id: <3dc21c00.41701339@news.erols.com>

pjdouillard@snclavalin.com (P.J Douillard) wrote:

: sub processNode {
:     my ($nodeLinesRef, $sIndex, $eIndex) = @_;
:     my %curNodePermission  = ();  # this hash is local
:     my @tmpArray;
:     my $path;
:     my $account;
:     my $dirFile;
:     my $tempLocalGroup;
:     my $curLocalGroup;
:     my $curSuffix;
:     my $localGroup;
:     my $suffix;
:     my $tempLocalGroupName;
:     my $curMembers;
:     my $members;
:     my $added;

Loose scoping.  Declare variables in the smallest scope necessary.

:     # Find distinct permission
:     #print "\nPermissions to process...\n";
:     foreach $line (@$nodeLinesRef) {

What is the scope of $line?  Could this be altering a value needed
elsewhere in the program?

:         $line =~ /(.*;)(.*;)(.*;)/;
:         $path = $1;
:         $account = $2;
:         $dirFile = $3;

Never use $1, $2, etc. without ensuring the match succeeded.
Better to say

         my($path, $account, $dirFile) = $line =~ /(.*;)(.*;)(.*;)/;

:         $tempLocalGroupName = 'L01'.&genLocalName($path).'01-'.&getSuffix($dirFile);

Don't use the &foo(...) form of subroutine call unless you know what
the effects are and you need those effects.
Use the plain foo(...) form instead.

:         if (exists $curNodePermission{$tempLocalGroupName}) {
:             # Add only members
:             push @{$curNodePermission{$tempLocalGroupName}}, $account;
:         }
:         else {
:             # Add a new permission to collection
:             $#tmpArray = 0;     # empty tmp array of members

That does not empty @tmpArray.  It truncates @tmpArray to the zeroth
member.  IOW, there is one element in it.

:             push (@tmpArray, $account);

And now there are two elements in it.

:             $curNodePermission{$tempLocalGroupName} = [ @tmpArray ];
:         }

That whole if-else structure looks like two paths to the same
destination.  Just do the push() from the 'if' portion and count on
autovivification to create array refs as needed.

:     }
:     # Now for each permission in %curNodePermission, try to find them
:     # in %colParentGroupList <-THIS IS THE GLOBAL HASH VARIABLE
:     while ( ($curLocalGroup, $curMembers) = each %curNodePermission) {
:         $curLocalGroup =~ /(.*-)(.*$)/;
:         $curSuffix = $2;

          my($curSuffix) = $curLocalGroup =~ /.*-(.*$)/;

:         # Check now in %colParentGroupList
:         $added = 0;
: # Ok sometime, on the second time this routine is called, %colParentGroupList
: # is empty, but should contains a key and an array added the call before.
: # Sometime, it's ok and it works fine?!  WHY??

Impossible to say.  Narrow "sometime" down to exact cases, and the
problem will probably make itself evident.

:         while ( ($localGroup, $members) = each %colParentGroupList) {
:             $localGroup =~ /(.*-)(.*$)/;
:             $suffix = $2;

              my($suffix) = $localGroup =~ /.*-(.*$)/;

:             # Check only members of group of same permission
:             if ($curSuffix eq $suffix) {
:                 # Are the members the same?
:                 if (&compareMembers(\@{$curMembers}, \@{$members})) {
:                     # Yes, then use the group found in %colParentGroupList to fix the security
:                     for (my $i=$sIndex; $i<=$eIndex; $i++) {
:                         chomp($lines[$i]);

What is the scope of @lines?  Are you sure code elsewhere in the
program isn't altering its content?

:                         $lines[$i] .= '(parent)'.&fixGroup($localGroup); # removes the '-' from the group name
:                     }
:                     $added = 1;
:                     last;   # exit inner while loop
:                 }
:             }
:         }
:         if (!$added) {      # A group was not found, so use the new and add it to %colParentGroupList
:             for (my $i=$sIndex; $i<=$eIndex; $i++) {
:                 chomp($lines[$i]);
:                 $lines[$i] .= '(new)'.&fixGroup($curLocalGroup);
:             }
: ## HERE ##          $colParentGroupList{$curLocalGroup} = [ @{$curMembers} ];

Did you mean to comment that out?

:         }
:     }
: }

Be careful about automatic word-wrapping when posting code.



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

Date: Fri, 01 Nov 2002 10:49:00 +0000
From: Buck <buck@buck.buck>
Subject: Question about changing variables in URL
Message-Id: <3DC25C1B.59D01ACA@buck.buck>

Recently I purchased Perl and CGI for the World Wide Web by Elizabeth
Castro. Its been pretty useful up to now but a lot of the book seems to
be tutorials about things I'm not too interested in doing. I know I
would benefit by reading the entire book and then be able to figure out
the problems myself, but its nearly 300 pages and I've got a bit of a
personal deadline.

What I wanted to do is create a perl script that will enable me to make
links that will create pages on the fly as it were.

I'm making a website, and I want each subpage to look similar to the
index page, but have different keywords so they match the respective
subpage. I have decided it would be easiest to create a script that had
a couple of variable params in it, so if I was doing a site about TV
scheduling I might have the variables $network, $showname etc.

The html parts in the perl script would be things like:
<title>$showname on $network</title>
<meta name="keywords" content="$showname on $network, $showname
listings, $showname schedule">
<meta name="description" content="Scheduling details for $showname on
$network">

 ...and so on! Since the site will have literally thousands of subpages,
it will make life a lot easier for me this way. So to link to these
generated pages I would have things like
http://www.blah.com/cgi-bin/link.pl?network=FOX&showname=The&nbsp;Simpsons

Now the problems I've encountered:
1) The script refuses to load on my server (I'm using Sambar 5.2 on my
PC). I've got other scripts working (really simple ones, only involving
printing text), but the minute I add anything like "use strict;" it
stops working. Is this a problem with Sambar? Here is the code I've been
trying to use. Perhaps someone can spot a problem with it?

#!C:\Perl\bin\perl.exe

my $network;
$network = param('network');

my $showname;
$showname = param('showname');

my $filename;
$filename = param('filename');

print "Content-type: text/html\n\n";
print "$showname on $network schedule.";

The $filename is for a server side include I'll have for the page with
the scheduling details itself... so it will tell the page to include
$filename.shtml. This way I can make more basic html pages without all
the code for graphics and tables, save it as thesimpsons.shtml and the
cgi-script will stick it into the right place of the page by itself!
This method will also make it easy to change the design of the entire
site without altering thousands of pages.

The second problem I can think of is having &nbsp; (a text space without
having an actual space) in the URL -- will it look for a variable param
called nbsp; because of the "&"?

Any help would be much appreciated,

Thanks!
Buck



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

Date: Fri, 01 Nov 2002 10:54:58 GMT
From: Jim Ryan <ryan@jimryan.com>
Subject: Search for a string while in PerlDoc?
Message-Id: <MPG.182c278f77951cb9989708@news1.news.adelphia.net>

[This followup was posted to comp.lang.perl.misc and a copy was sent to the cited author.]

How do I do this?  If I'm reading about something lengthy in perldoc and 
want to find a string within it, what do I type at the --more-- prompt?

Thanks
-- 
Jim
Please CC: by E-mail


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

Date: 01 Nov 2002 09:19:03 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Why is this an infine loop???
Message-Id: <u98z0dfy0o.fsf@wcl-l.bham.ac.uk>

Benjamin Goldberg <goldbb2@earthlink.net> writes:
> >     Also, can you explain why the following results in an infinite
> >     loop:
> >
> >     while( $current_website->{html} =~ /<.*?>/gs ) {
> >         $num_tags++;
> >    }
> > 
> >     But this does not result in an infinite loop and properly counts
> > the number of HTML tags:
> >     my $temp = $current_website->{html};
> >     while( $temp =~ /<.*?>/gs  ) {
> >         $num_tags++;
> >     }
> 
> My guess is that $current_website is a reference to a tied hash;

That would have been my guess too if I'd joint the thread at this
point.

Indeed this explaination is so tempting I had to work quite hard to
stop myself putting it forward :-).

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 4055
***************************************


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