[6855] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 480 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 15 06:17:18 1997

Date: Thu, 15 May 97 03:00:21 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 15 May 1997     Volume: 8 Number: 480

Today's topics:
     Re: A perl routine to fetch an url (mara)
     Re: adding to an array within a while(<>) (Kyzer)
     Re: Best way to include one script in another <simonk@telebusiness.co.nz>
     Beta Testers for PMS <buck@huron.net>
     Re: Bug report: Perl dumps core on funny split (Dominic Dunlop)
     calling a Win32 API function from a Perl script <hhowe@trgnet.com>
     Re: Graphing a tree from a text <kenlo@hk.super.net>
     List of List Question I think (assigning LOTS of variab <hunter@fsc.fujitsu.com>
     Re: MacPerl interface <B.P.Fowler@rack.demon.co.uk>
     Re: Parsing a Text File by Perl??? (Craig Berry)
     Re: PERL & MS PWS <petri.backstrom@icl.fi>
     perl installation for dynamic modules <jbosch@tid.cdscc.nasa.gov>
     Re: Perl on Windows NT4.0 <petri.backstrom@icl.fi>
     Perl Win32 and CreateProcess <popineau@ese-metz.fr>
     Re: Randal Schwartz <B.P.Fowler@rack.demon.co.uk>
     Re: running ftp in Perl script AlvinKoh@WriteMe.COM
     simple dir q <seanm@edmark.com>
     Re: SOLUTION: Drawing a graph? (Mont Erickson)
     Re: Sorting Records <simonk@telebusiness.co.nz>
     Re: Strange effect <nnyxcu@ny.ubs.com>
     Tough replacement problem <hamptonk@bible.org>
     Re: Weather Forecasts via perl <gwhassan@prodigy.net>
     What happens with $ENV{'HTTP_REFERER'} ? <ssole@ptl.es>
     Re: What happens with $ENV{'HTTP_REFERER'} ? (A. Deckers)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 15 May 1997 08:28:41 GMT
From: mara@0.0.0.0 (mara)
Subject: Re: A perl routine to fetch an url
Message-Id: <5lehfp$d9p@nntp.hut.fi>

In article <m1k9l2f53n.fsf@nauplius.psc.sc.edu>
Dean Pentcheff <dean@tbone.biol.sc.edu> writes:

> mara@0.0.0.0 (mara) writes:
> > I need to fetch image files on another server and show them in a
> > separate browser window. The problem is that I need to test the url
> > before showing
> > it. So, I figured that my CGI-script should fetch that url and
> > depending
> > on what it receives, produces the desired output.
> 
> You'll want to visit the CPAN archive of Perl code.  Start at
> <URL:http://www.perl.com/perl>.  Once there, go to the CPAN archive
> and look for the full module list.  There are several that pertain to
> WWW programming using Perl.  There are good modules for doing simple
> or sophisiticated URL checking or retrieval (all with full
> documentation).  

Dean,

Thanks for your pointer. I checked the CPAN archive and there are
indeed
a lot of related modules. But perhaps a little too many :-) 
Do you remember any well documented examples of simple and
sophisticated
URL checking?

Just for fun actually...luckyly I managed to find one from MIT.
http-get is simple and seems to be working without any extra packages
<http://www.tns.lcs.mit.edu/cgi-bin/code>.

/mara


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

Date: 9 May 1997 09:02:06 GMT
From: junkmail@sysa.abdn.ac.uk (Kyzer)
Subject: Re: adding to an array within a while(<>)
Message-Id: <5kup6e$rid@info.abdn.ac.uk>

When sdm met comp.lang.perl.misc....:
: Is there a way to easily add to an @array each pass through a while() loop,
: without the next pass obliterating what was there on the previous pass?
: Everything I find in my books seem to bypass/overlook this.....

Would this be the push function or the unshift function (in the perlfunc
manpage)? Just a thought.

: thanks,
#!/bin/perl -w
use strict;
my @array = ();
my @array2 = ();
while(<>) {
  push @array, $_;
  unshift @array, $_;
}
print "All the lines of all the files you passed to this script:\n";
print join('',@array);
# (of course of that could be done in one line: 'print <>'  :)
print "All the lines of all the files you passed to this script BACKWARDS:\n";
print join('',@array2);
# (of course of that could be done in one line too: 'print reverse <>'  :)


--
Stuart 'Kyzer' Caie - Kyzer/CSG |undergraduate of Aberdeen University |100%
http://www.abdn.ac.uk/~u13sac   |My opinions aren't those of Aberdeen |Amiga -
kyzer@4u.net kyzer@hotmail.com  |University or AUCC, thankfully.***** |always!

-- 
Random sig of the day:
"Blue neon electric hippopotamus flickering daintily in the esoteric skies of
my mind while  tripping out on an illegal substance  I recently consumed at a
rave in  Peterhead but  I honestly don't  remember the dealer at all nice  Mr
Policeman and please remove these nasty handcuffs because they are hurting my
wrists amongst other parts of my anatomy." (Working title)


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

Date: 15 May 1997 07:15:41 GMT
From: "Simon Kitching" <simonk@telebusiness.co.nz>
Subject: Re: Best way to include one script in another
Message-Id: <01bc6100$6c719a90$cbe824ca@simonk>

Personally, I can't see why you don't want to create a module - a module is
just a file.
If you have something against naming your file with a ".pm" extension, then
you can use
the "require" keyword, which doesn't care about the file suffix.

"But require works only at runtime" you complain? Try
BEGIN {require "myfile.h";}
This will be executed as soon as the perl parser comes across it, so that
functions later in the
main file can access the variables/functions in the "include" file.

Boris Burtin <boris@dailyrocket.com> wrote in article
<33774012.BB69BB7@dailyrocket.com>...
> I'd like to hear some suggestions about using "include files" in Perl. 
> In C, you can say
> 
> #include "myfile.h"
> 
> .....



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

Date: 14 May 97 21:20:23 GMT
From: "Stephen Hill" <buck@huron.net>
Subject: Beta Testers for PMS
Message-Id: <01bc60ac$64001660$138fd4c7@Garcia.huron.net>

Beta testers Needed for my messaging system, It is all written in perl.

http://www.huron.net/~buck/bbs

Please check it out and report any bugs that you may come across to me at
buck@huron.net.

Thanks for your time :-)




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

Date: Thu, 15 May 1997 10:23:14 +0200
From: domo@tcp.ip.lu (Dominic Dunlop)
Subject: Re: Bug report: Perl dumps core on funny split
Message-Id: <19970515102314471011@dialup01.ip.lu>

era eriksson <reriksso@cc.helsinki.fi> wrote:

> Here's a working script:
> 
>  $ echo foo | perl -ne 'split /\s*,\s*/'
>  foo
> 
> Here's one that dumps core:
[with perl5.001m on SunOS and 5.003 on Alpha OSF/1 4.0]
> 
>  $ echo foo | perl -ne 'split /\s*(,\s*)?/'
>  Segmentation fault (core dumped)

I can't reproduce this, either on 5.003 or on really really really
soon-to-be-released 5.004 'gamma' (both on MachTen 4.0.3).  Somebody
running 5.004 on an Alpha needs to see if the problem is present or gone
on that platform.

>  The manual page doesn't tell you where to send bug reports so I
>  figured ...

Well, actually, the information's on the 5.003 perl man page (derived
from pod/perl.pod in the source distribution), and, for good measure, in
the INSTALL and README files.  It's also in part 2 of the current FAQ.
May I suggest you resubmit using the procedure described in those
places?
-- 
Dominic Dunlop


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

Date: Thu, 15 May 1997 01:03:53 -0500
From: Harold Howe <hhowe@trgnet.com>
Subject: calling a Win32 API function from a Perl script
Message-Id: <337AA749.38C1@trgnet.com>

Howdy folks,


1- Can an API function be called from within the Perl script, like
GetSystemMetrics?

2- Can a Perl script call a DLL function, if I provide the DLL?


Harold Howe
hhowe@trgnet.com


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

Date: Thu, 15 May 1997 15:58:30 +0800
From: Kennth LO <kenlo@hk.super.net>
Subject: Re: Graphing a tree from a text
Message-Id: <337AC226.77AA@hk.super.net>

Mike McLeod wrote:
> 
> Does anyone know of a chunk of code that will take a text representing a tree and
> convert it into a graphical representation in say gif format?

Not sure your requirements but try the daVinci graph visualization
system at 	
	http://www.informatik.uni-bremen.de/~davinci/ 

That's not perl at all.


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

Date: Thu, 15 May 1997 01:03:12 -0700
From: "Hunter L. Brown" <hunter@fsc.fujitsu.com>
Subject: List of List Question I think (assigning LOTS of variables.)
Message-Id: <337AC340.63CB4DF@fsc.fujitsu.com>

Hi everyone,

This is my first posting to this newsgroup. Forgive me as I am
relatively new to perl.

I have conducted a survey (web page survey). Now, it's time to process
the data. I have collected it all, split it up, everything is dandy I
can print out things the way I want.

NOW, I need to make some variables for each question return value so I
can process percentages and statistics, etc.

How can I assign these variables without typing them all out?

For example:
Before I got smart, I was typing this out:

$QUESTION_7 = "0";
$QUESTION_7_A = "0";
$QUESTION_7_B = "0";
$QUESTION_7_C = "0";

$QUESTION_7_A_1 = "0";
$QUESTION_7_A_2 = "0";
$QUESTION_7_A_3 = "0";

etc, etc.

To save time and space for Question 8 since there are multiple choices A
- J and sub choices 1 - 5, I was gonna do it this way (Complicated
Survey!):

@EIGHT = (A,B,C,D,E,F,G,H,I,J);
@EIGHTnum = (1,2,3,4,5);
$QUESTION_8 = "0";
$indEIGHT = "0";

foreach (@EIGHT) {
$QUESTION_8_$EIGHT[$indEIGHT] = "0";
$indEIGHT ++;
}

((I'll worry about the sub multiple choices 1-5 later)).

Obviously my syntax above is wrong and won't work.

What is the best way to get the variables assigned without typing them
all out? Can you perhaps show me how you'd do it?

Thanks much,

Hunter

-- 
HUNTER L. BROWN    | Web Information Developer
                   | FUJITSU SOFTWARE CORPORATION
mailto:hunter@fsc.fujitsu.com  
http://www.fsc.fujitsu.com/~hlbrown


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

Date: Thu, 15 May 1997 08:40:49 +0000
From: Ben <B.P.Fowler@rack.demon.co.uk>
Subject: Re: MacPerl interface
Message-Id: <337ACB6B.56D0@rack.demon.co.uk>

> I'm curious ... would a Mac-o-phile like to post and explain the
> benefits of such an interface.  Does the Mac not have a "command
> line"?  Could this sort of interface be grafted onto the Win-32
> port of Perl?

It is easy to post, but are we on-charter here?

1. The Mac version of perl was produced by handful of people,
chiefly Matthias Neeracher <http://www.iis.ee.ethz.ch/~neeri/>,
and the credit for the various compromises involved in making perl
work under a mature GUI beongs to him.

2. Explaining the benfits of a GUI would take too long to do here,
but there is plenty of information elsewhere on the net. You 
could start from <http://www.macos.com/>. In brief, the Mac GUI
sprang from pioneering work done in the 1960's by Englebart,
and was produced in 1984 under a terrific time pressure by
a talented team and Steve Jobs. Whilst there has been dispute
over the extent to which Jobs role was crucial, I think that it 
is fair to say that neither Jobs nor anyone else has pulled off
such a project before or since. This is well documented in print
and on the web. The main reason why a command line interface
was not provided was to require developers to take the harder
route of providing the easier GUI for the end users. The BeOS
has a command line interface: perhaps they did not have to do
the ground breaking working of the Mac team.

3. I don't know anything about the Win32 system, and neither
will most Mac people.

Ben.


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

Date: 15 May 1997 05:24:14 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Parsing a Text File by Perl???
Message-Id: <5le6lu$emv$3@marina.cinenet.net>

$j,u?OE" (swsung.bbs@cis.nctu.edu.tw) wrote:
: Is it easy to write a Perl program for parsing a text file?

Perhaps 95% of all Perl scripts ever written do this very thing, if you
use broad (but useful) definitions of 'parsing', 'text', and 'file'. 

: If yes, is there a sample program?

Zillions.  I recommend the Llama and Camel books, and examining the many 
scripts available via CPAN and numerious other sources.

: Any answers will be highly appreciated.

Hope this helps!

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Thu, 15 May 1997 10:25:19 +0200
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: PERL & MS PWS
Message-Id: <337AC86F.4F72@icl.fi>

Sam Azer wrote:
> 
> Can anybody point me to some docs re: PERL and
> Microsoft's Personal Web Server?
> 
> I would like to be able to test my CGI scripts locally
> before posting to my web site. I have PWS up and
> PERL5 installed and running, but I can't get PWS
> to execute the scripts. Any help would be appreciated.

See the "Perl for Win32 Frequently Asked Questions (FAQ)" at:

  http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html

It has all the information you need in FAQ 6.3.

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


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

Date: Thu, 15 May 1997 05:45:42 GMT
From: John Bosch <jbosch@tid.cdscc.nasa.gov>
Subject: perl installation for dynamic modules
Message-Id: <337AA306.3BCAAF7F@tid.cdscc.nasa.gov>

Hi,

I'm having problems getting perl to dynamicly load modules. I've compiled perl a

When I ran make test, however, it really bombed out on nearly all the provided m

lib/gdbm.......Can't load '../lib/auto/GDBM_File/GDBM_File.so' for module GDBM_F
^M
 at ../lib/GDBM_File.pm line 81^M
BEGIN failed--compilation aborted at ./lib/gdbm.t line 14.^M
FAILED on test 0^M


I can't work out what's wrong. Can anyone help? Emailing me would be best.

Thanks in advance,

-- 

regards,

John Bosch
Electrical Engineer
Canberra Deep Space Communications Complex

email : jbosch@tid.cdscc.nasa.gov
        John.R.Bosch@jpl.nasa.gov
www :   http://tid.cdscc.nasa.gov/~jbosch

=====================================================


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

Date: Thu, 15 May 1997 10:40:24 +0200
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Perl on Windows NT4.0
Message-Id: <337ACBF8.3941@icl.fi>

Jenny Khuon wrote:
> 
> Does anyone can give me a pointer where I can get perl's Windows NT version.

Bookmark these (the first one is the kit, the second one has what you
need to know in addition, and the other pointers will also lead you to
useful information):

Perl for Win32:

  http://www.activeware.com

Perl for Win32 Frequently Asked Questions (FAQ):

  http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html

The Perl Language Home Page:

  http://www.perl.com/perl/

Perl FAQ:

  http://www.perl.com/perl/faq/index.html

Perl Reference:

  http://www.panix.com/~clay/perl/

Comprehensive Perl Archive Network (CPAN):

  http://www.perl.com/CPAN/

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


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

Date: 15 May 1997 10:25:05 +0200
From: Fabrice POPINEAU <popineau@ese-metz.fr>
Subject: Perl Win32 and CreateProcess
Message-Id: <ud8qtf8gu.fsf@ese-metz.fr>


Hi,

It seems that CreateProcess() may fail under 5.003 build 4 and 7.
What happened to me is: sometimes the process is launched, sometimes
not. I don't understand why. All examples are taken from latex2html
that I'm porting to win32. More precisely, I have the following
function:

sub syswait {
    local($_) = @_;
    local($status);
    local(@args) = split(' ', $_);
    local($ProcessObj,$ExitCode, $cwd);
    print "$_\n" if ($DEBUG);
# My goal is to mimic the following from perl-unix
#    print "$args[0], $args[1]\n$pargv\n";
#     if ($child_pid = fork) {
# 	$status = waitpid($child_pid, 0);
# 	$child_pid = 0;
# 	return($?);
#     }
#     else {
# 	exec($_);
# 	print "$_[0]:  $!\n";
# 	exit($!);
#     }

    #Create the process object.
    $cwd = &getcwd;
    $args[0] = &find_executable($args[0]);
  
    Win32::Process::Create($ProcessObj,  #object to hold process.
			   $args[0], #executable
                           $_,    #command line
			   0,   #no inheritance.
			   DETACHED_PROCESS, #separate process
			   $cwd) || die &Error; #current dir.

    #Set the process priority
    $ProcessObj->SetPriorityClass(Win32::Process::NORMAL_PRIORITY_CLASS)
	 || die &Error;
    print "waiting for $ProcessObj...\n";
    #Wait for the process to end. NO timeout 
    $ProcessObj->Wait(Win32::Process::INFINITE) || die &Error;

    print "finished for $ProcessObj...\n";
    
    $ProcessObj->GetExitCode($ExitCode) || die &Error;
    print "Exited from syswait with code $ExitCode.\n";
    return $ExitCode;
}

The functions find_executable and getcwd are working.
If I call syswait with something quite simple like:

	&syswait("$LATEX ./${PREFIX}images.tex");

Everything is right. But if I call, say perl with a perl script and
lots of arguments like:

                &syswait( "$PSTOIMG -$IMAGE_TYPE " .
                 (($DEBUG) ? "-debug " : '' ) .
                 (($INTERLACE) ? "-interlace " : '' ) .
		 (($custom_size) ? "-geometry $custom_size " : '' ) .
                 (($flip) ? "-flip $flip " : '' ) .
                 (($scale > 0) ? "-scale $scale " : '' ) .
                 (($TRANSPARENT_FIGURES  && ($env =~ /figure/o)) ? 
	           "-transparent " : '') .
                   "-out ${PREFIX}$img $psname.ps"
                ) && print "Error while converting image: $!\n";


then if fails.

Could some kind soul help me ?

Thanks in advance,


-- 
Fabrice POPINEAU
------------------------
e-mail:         popineau@ese-metz.fr    |  "God is real ...              
	Fabrice.POPINEAU@supelec.fr     |
voice-mail:   +33 (0) 387764715         |          ... unless integer ?"
surface-mail: Supelec, 2 rue E. Belin,  |
	      F-57078 Metz Cedex 3      |


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

Date: Tue, 13 May 1997 19:32:04 +0000
From: Ben <B.P.Fowler@rack.demon.co.uk>
Subject: Re: Randal Schwartz
Message-Id: <3378C198.6974@rack.demon.co.uk>

Tad McClellan wrote:
> 
> Michael Lauzon (ce940@torfree.net) wrote:
> : This is a question for Randal Schwartz.
> 
> Well, then you delivered it the wrong way.
> 
> Posts to Usenet go to THOUSANDS of computers around the entire World,
> and are also read by thousands of people.
> 
> Individual communications should use an individual communication 
> medium such as email.

RFD: alt.fan.randal-schwartz, or



Ben


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

Date: Thu, 15 May 1997 13:44:17 +0800
From: AlvinKoh@WriteMe.COM
Subject: Re: running ftp in Perl script
Message-Id: <AlvinKoh-1505971344170001@fsng172mac.ops.sing.paging.mot.com>

In article <01bc60e4$bf78b460$5378238a@pc1.asia.compaq.com>, "cedric tio"
<cedric=tio%design%eng=sin@bangate.compaq.com> wrote:

>I need to ftp a file from another server while running a Perl program. Does
>anyone know how I can pass arguments to the ftp program while running a
>Perl program? Is it possible for the Perl program to supply the user
>account name, password, and ftp commands to the ftp program so that the
>user does not have to enter anything.
>I am working on a Unix X-terminal.
>Thanx.

Try using the .netrc file. You put the ftp commands like user, password,
etc in here. It is not secure, but does the job.

Rgds

-- 

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
  Alvin Koh       <AlvinKoh@WriteMe.COM>

 ...Today's dreamers are tomorrow's achievers....ZZZZZZZZZZZ....

($$$)-($$$)-($$$)-($$$)-($$$)-($$$)-($$$)-($$$)-($$$)-($$$)-($$$)                                   


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

Date: Wed, 14 May 1997 23:46:43 -0700
From: "news.accessone.com" <seanm@edmark.com>
Subject: simple dir q
Message-Id: <5leb7k$m43$1@kanga.accessone.com>

Hi all-

i'm getting really frustrated with win to unix.  i created a (very) simple
search prog, that will work on and NT box but dies horribly when trying to
traverse the unix directories.  where i found it dieing is at a foreach
line, i've got two directories i want to search through, and i put them
into and array @dir = ("$document_root/somedir1/","$document_root/someotherd
ir/";);
this part will work then i change to the first in a foreach and grep(-T,
readdir(DIR));   this is bringing back the number of files, not the names. 
so my foreach on the files dies trying to open /somedir/68  where 68 is the
total number of files.  where is the file name.??? 

i'd really appreciate any help
--------------warning...<gryn> this may be ugly.-------- but it works for
NT anyway

foreach $dir (@dir) {
  chdir($dir) || die "can't Change to $dir $!\n";
  opendir(DIR, "$dir");
  @files = grep(!/^\.\.?$/, readdir(DIR));  # even grep(-T, readdir(DIR));
doesn't work quite right..
  
  foreach $file (@files) {
    $newdir = "$dir$file";
    open(FILE, "$newdir") || die "can't open file $!\n";

    while (<FILE>) {
      if ((/[^<.>]$word?/o)) {
        $file =~ s/inc/html/;
        $a = $_;
        $a =~ s/<([^>]|\n)*>//g;
        $a =~ s/$word/$fc$word$fe/g;
        print "$dir$file\n";          # LINK line
        print $a,"\n";                   # PHRASE line
        }
      }
    next;  #next file
    }
  close(DIR);
  next; #next dir
  }
}
else {
 &errormsg;
 }

           ------->
--------.-< mailto:seanm@edmark.com >-.-------------------------------------

                         <-------

Programmers don't die...  they just GOSUB without RETURN.
Backup not found: (A)bort, (R)etry, (P)anic

wrk.    http://www.edmark.com/
play    http://www.geocities.com/paris/3313/





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

Date: Thu, 15 May 1997 06:20:29 GMT
From: merick@xmission.com (Mont Erickson)
Subject: Re: SOLUTION: Drawing a graph?
Message-Id: <5le6ca$11q$1@news.xmission.com>

Matt Kruse <mkruse@shamu.netexpress.net> wrote:

>http://mkruse.netexpress.net/perl/

>Here you will find my start of a module - Graph.pm

>It uses GD.pm to do the graph creation entirely in perl (and is therefore 
>totally portable!  yippee!).  It will do what you want - you give it some 
>points and and it will create a graph that looks good.  Of course, you have 
>total control over everything in the graph too if you want.

>Right now, it just does bar graphs.  I don't have time to keep working on it 
>right now, but I'd *LOVE* to have someone add functionality.  I think I have 
>a great start on it, and adding to it wouldn't be too tough.

>It's been working great for me at work in several applications (which is why 
>i started writing it).

I've gotta second Matt's motion here.  Matt definitely has a good
start on this and it would be great for people to take what he has and
add functionality.  I use his Graph.pm all the time now.  It's great.

It would be excellent if someone added some of the following:

  Verticle Bar Chart
  Stacked Bar
  3-D Bar (sort of already there with the shadowning effect)
  Pie (2D/3D)
  Line Graph (2D/3D)
  Scatter Plot
  Grouped Data 

Hopefully, time permitting, I'll start on a few of these myself.



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

Date: 15 May 1997 07:29:44 GMT
From: "Simon Kitching" <simonk@telebusiness.co.nz>
Subject: Re: Sorting Records
Message-Id: <01bc6102$6349c8a0$cbe824ca@simonk>



James Ringrose <Jamesr@tiac.net> wrote in article
<337a6cf1.2364363@news.tiac.net>...
> Hi,
> 
> I have a script that uses 'records' to read a text file consisting of
> several lines of associated data. This gives me a very controllable
> way of accessing each 'record' and it's associated 'fields'. 
> 
> My problem is in getting the sort function to work on the data. I
> ....
>
> sub byalpha { 
> 	%{$database[$a]}->{"Time"} cmp %{$database[$b]}->{"Time"}
> 	};
> 
> @sorteddatabase = sort byalpha @database;
> 

Just from "eyeballing" your code, your approach is fine. I have done
similar often.
I think your sort function is wrong...

sub byalpha
{
  $database[$a]->{"Time"} cmp $database[$b]->{"Time"}
}


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

Date: Thu, 08 May 1997 10:16:41 -0400
From: Glen Culbertson <nnyxcu@ny.ubs.com>
Subject: Re: Strange effect
Message-Id: <3371E049.42E8@ny.ubs.com>

In my tests of this I seem to see this general pattern:

If 
  1. inside a block (any block, not just 'if-then-else' blocks)
     a variable is declared using my(); and
  2. the first statement after the end of the block is an assignment to
     a variable with that name;
Then
  The assignment does not 'take'. 
  The value of the variable does not change.
  It retains whatever value it had before the start of the block (no value if
  it had never been assigned to).

I only tested scalars so far. Haven't tried arrays and/or hashes.

This is NASTY.

Does anyone have any info?

I am also using 5.003.


stephen farrell wrote:
> 
> "Fischer (Softing)" <fischer@hgz25.hub.de> writes:
> 
> > Hello!
> >
> > Can anybody help me with the following question?
> > Start the little program below with the print-line
> > commented and uncommented. The result will be different.
> > Why is this?
> > Anyway if the print-line is commented, the value of $x immediately
> > after $x = 1 is NOT 1. Why?
> > This all seems to be connected with the 'my' in the body of the
> > if-part. What happens exactly?
> > Can anybody reproduce this effect? I used version 5.002.
> 
> Yes.  5.003.  It appears to also be related to the if/else jobber.
> 
> > Can anybody expalin this effect?
> 
> No, not at all.
> 
> >
> > thank you very much
> >
> > F.Fischer
> >
> > ---> cut here
> > #!/usr/local/bin/perl -w
> >
> > #=== use this one with perl version 5.002
> >
> >
> > my $x = 0;
> >
> > if (0) {
> >     my $x = 1;
> > } else {
> >     #=== commenting the next line has an effect on the value of $x
> >     #=== WHY IS THIS ?
> >     print "foo\n";
> >     $x = 1;
> >     print "x is $x\n";
> > }
> > ---> cut here
> 
> --steve farrell


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

Date: 15 May 1997 06:05:55 GMT
From: "Hampton Keathley" <hamptonk@bible.org>
Subject: Tough replacement problem
Message-Id: <01bc60ed$d4adb200$391a56a0@hercules.ods.com>


I use perl almost daily and do lots of regular expression stuff, but don't
have any idea how to do the following:

I have a file with lines that look like this:

text text text text <greek>agapv wuix</greek>

I need to search through a rather large file and search and replace various
characters between the <greek> codes.

How do I grab only the text between the tags and then do a search and
replace on only the "v" or the "x" that is within the <greek> tags and not
mess up the v or x outside the tags?


Thanks

Hampton Keathley
webmaster
www.bible.org
hamptonk@bible.org



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

Date: Wed, 14 May 1997 23:32:34 +0000
From: Greg Hassan <gwhassan@prodigy.net>
To: "G. Bowden Wise" <wiseb@cs.rpi.edu>
Subject: Re: Weather Forecasts via perl
Message-Id: <337A4B91.28AC1F27@prodigy.net>

G. Bowden Wise wrote:
> 
> The weather undergronud has a number of cgi scripts running from their
> site.  Is there a way for me to write a perl script that will
> do the connection to the site and do an HTTP get to get the forecast?
> 
> I want to create an exercise for my students to send a request to
> a perl script, but due to applet security, the script must reside on the
> same server as the applet.
> 
> So i need to write a perl script that can do the connect to the
> undergronud host and get teh data for them.
> 
> has anyone any weather forecast scripts in perl?

Hello,

I would say that taking the information from someone else's site
without their knowledge is not the best way to go...

I know the weather underground people, if you just ask, you
might be better off.  They have an auto-branding system
all setup for this sort of thing.

-Greg
-- 
============================================
                Greg Hassan
          The Independent Solution
 Web Developer (CGI, Java, C, Perl, Oracle)
           http://www.hassan.com/        
            gwhassan@prodigy.net
============================================
   Free World-Wide Classified Listings
      (http://www.hassan.com/.classifieds/)
      
   Or Maybe a Birthday coming up?
     Try: (http://www.hassan.com/cooie/)
============================================


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

Date: Mon, 12 May 1997 13:04:42 +0200
From: Sergi Soli i Fern`ndez <ssole@ptl.es>
Subject: What happens with $ENV{'HTTP_REFERER'} ?
Message-Id: <3376F94A.1CDF@ptl.es>

Hi All !

I'm in a trouble with a script, cos it won't to get the
$ENV{'HTTP_REFERER'}.

Anyone know what's the problem ?

I have Perl 5.003 in a Sun Solaris 2.5 and a Netscape Enterprise
Server Running. I use the cgi-lib.pl.

Thank You !

Sergi Soli i Fern`ndez
Webmaster
Universitat Pompeu Fabra
Barcelona
Spain


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

Date: 12 May 1997 14:47:45 GMT
From: I-hate-cyber-promo@man.ac.uk (A. Deckers)
Subject: Re: What happens with $ENV{'HTTP_REFERER'} ?
Message-Id: <slrn5nebch.h1i.I-hate-cyber-promo@news.rediris.es>

In comp.lang.perl.misc,
	ssole@ptl.es wrote:
>Hi All !
>
>I'm in a trouble with a script, cos it won't to get the
>$ENV{'HTTP_REFERER'}.
>
>Anyone know what's the problem ?

No, but maybe that variable isn't defined.

In any case, it sounds like you have a CGI-related rather than a
Perl-related problem. Please post your question to
comp.infosystems.www.authoring.cgi, where followups to this post are
set.

But first, please read the following documents:

# CGI Programming FAQ:
#      <URL:http://pobox.com/%7Ewebthing/docs/cgi/faqs/cgifaq.shtml>
# Idiots Guide to Solving Perl CGI Problems:
#      <URL:http://www.perl.com/perl/faq/idiots-guide.html>

>I have Perl 5.003 in a Sun Solaris 2.5 and a Netscape Enterprise
>Server Running. I use the cgi-lib.pl.

Consider using the newer and IMHO superior CGI.pm. You'll find it on
CPAN (see below).

HTH,

Alain

-- 
Perl information: <URL:http://www.perl.com/perl/>
    Perl archive: <URL:http://www.perl.com/CPAN/>
        Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
>>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<<<<<


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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 V8 Issue 480
*************************************

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