[17136] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4548 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 7 14:05:29 2000

Date: Sat, 7 Oct 2000 11:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <970941910-v9-i4548@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 7 Oct 2000     Volume: 9 Number: 4548

Today's topics:
        [ANNOUNCE] XML::Sablotron 0.44 <petr@gingerall.cz>
    Re: [UPDATE] mod_perl and ActiveState perl (v5.6.0 618) <randy@theory.uwinnipeg.ca>
        about ssh <initiald@netvigator.com>
    Re: about ssh <brian+usenet@smithrenaud.com>
    Re: ActivePerl 5.6 on NT 4.0/IIS4 not working <mikecook@cigarpool.com>
    Re: ActivePerl 5.6 on NT 4.0/IIS4 not working <blindb@hotmail.com>
        ANNOUNCE: GD::Graph 1.33 (Martien Verbruggen)
        ANNOUNCE: Lingua::EN::Dict v0.20 beta <jdb@wcoil.com>
    Re: Autologin script <jargoone@hotmail.com>
        Best definition of Perl so far in 19100 <rosie@dozyrosy.plus.com>
    Re: How do I get a cgi script to load a url <jeff@vpservices.com>
    Re: How do I get a cgi script to load a url <flavell@mail.cern.ch>
    Re: How do I get a cgi script to load a url <brian+usenet@smithrenaud.com>
        how to include and execute a sub routine from another p <geoff@brainstorm.net.au>
    Re: how to include and execute a sub routine from anoth <tony_curtis32@yahoo.com>
    Re: how to pass info to a script? (Richard Lippmann)
        modifying elements in an each() loop <jsalmon@thesalmons.org>
        MySQL BLOB types and DBD::mysql <andrea@defiant.stru.it>
    Re: Netscape supports Perl ? <stumo@bigfoot.com>
    Re: Not Entirely On Topic:  Programming and math <mauldin@netstorm.net>
    Re: Please Help nightmare running rel script. <jeff@vpservices.com>
    Re: Please help on "processing data problem" <mauldin@netstorm.net>
    Re: Please help on "processing data problem" <mauldin@netstorm.net>
    Re: Please help on "processing data problem" <mauldin@netstorm.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 06 Oct 2000 14:27:10 +0200
From: Petr Cimprich <petr@gingerall.cz>
Subject: [ANNOUNCE] XML::Sablotron 0.44
Message-Id: <stuns0oa6r20f8@corp.supernews.com>

The perl interface to the Sablotron XSLT processor is available on CPAN
now. Sablotron itself can be downloaded from www.gingerall.com.

Sablotron is fast, compact, and portable XSLT processor written in C++.
The current version supports a large subset of the XSLT specification.
Sablotron together with XML::Sablotron currently appears to be the most
convenient XSLT solution for perl (see
http://iterx.org/xslt/performance.html).





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

Date: Sat, 7 Oct 2000 12:56:05 -0500
From: "Randy Kobes" <randy@theory.uwinnipeg.ca>
Subject: Re: [UPDATE] mod_perl and ActiveState perl (v5.6.0 618)
Message-Id: <8rnobo$stl$1@canopus.cc.umanitoba.ca>

"Jerry Baker" <jbaker6953@yahoo.com> wrote in message
news:39DEBF8F.9A4C8832@weirdness.com...
> Jerry Baker wrote:
> >
> > Randy Kobes wrote:
> > >
> > > Do any of the troubleshooting hints at
> > > http://www.apache.org/docs/win_service.html
> > > help?
>
> I should have mentioned that my configuration already includes all of
> those suggestions. The crash still happens.

I'm not sure then what to suggest on the mod_perl/perl side ....
Would it be possible for you to try mod_perl out with
apache-1.3.13-dev? There's a few service-related changes
in that ... I'm not sure if the mod_perl ppm package will
work with that, though, even from the command line,
as it was compiled against apache-1.3.12. If it doesn't work,
let me know and I'll make a ppm compiled against 1.3.13-dev.
Thanks.

best regards,
randy kobes





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

Date: Sat, 07 Oct 2000 23:46:19 +0800
From: charlie <initiald@netvigator.com>
Subject: about ssh
Message-Id: <39DF454A.2BB75E45@netvigator.com>

Hello All , I am new to perl and have a question.
I type the command " ssh www.xxxx.com df -k " on my Solaris 7 machine
and the
result display on screen. So I write this code in perl

#!/usr/local/bin/perl -w
`ssh www.xxxx.com df -k`;

then chmod u+x filename.But
there are not result display on my screen and also no error message.
I have no idea, pls help.
Many Thank....




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

Date: Sat, 07 Oct 2000 14:04:36 -0400
From: brian d foy <brian+usenet@smithrenaud.com>
Subject: Re: about ssh
Message-Id: <brian+usenet-2EDB59.14043607102000@news.panix.com>

In article <39DF454A.2BB75E45@netvigator.com>, charlie 
<initiald@netvigator.com> wrote:

> #!/usr/local/bin/perl -w
> `ssh www.xxxx.com df -k`;
> 
> then chmod u+x filename.But
> there are not result display on my screen and also no error message.

backticks allow you to capture the output of commands.  the output
does not go to Perl's STDOUT.  perhaps you want the system command?

-- 
brian d foy
Perl Mongers <URL:http://www.perl.org>
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Sat, 7 Oct 2000 09:00:25 -0700
From: "Michael Cook" <mikecook@cigarpool.com>
Subject: Re: ActivePerl 5.6 on NT 4.0/IIS4 not working
Message-Id: <pNHD5.86$iH.103050@news.uswest.net>

Perl must be set up as shellcgi & the default MIME type for Perl must be
changed to execute. Read the AcitveState FAQ for IIS/Perl...
    Michael
--
== CigarPool ==
http://www.cigarpool.com

<cbutler@nospaam.cbjd.net> wrote in message
news:39e2bf2f.61277274@news-server...
> I've tried to setup the most recent version of ActivePerl 5.6 on a brand
> new WinNT 4.0 webserver 128Mb RAM, SP4, IIS4.0.
>
> The PerlScript examples included with the release worked on the server but
> would not work on a browser on a workstation accessing the webserver.
>
> Thinking that security setup might be a problem, I checked the settings
for
> the Perl directory.  Everyone had "full control".  I reset the directory
> and subdirectories to give Everyone "full control".  PerlScript then
ceased
> to function on a browser on the server.
>
> The install notes for Perl for IIS 4.0 were followed (ie. application
> mappings were set and Path was correct).
>
> Any ideas on what I need to do to get PerlScript to run on a NT 4.0
> webserver?
>




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

Date: Sat, 7 Oct 2000 10:30:35 +0200
From: "Blindb" <blindb@hotmail.com>
Subject: Re: ActivePerl 5.6 on NT 4.0/IIS4 not working
Message-Id: <39df536b$0$191@diablo.uninet.ee>

if you're talking about ex. "Hello" and "Calculator" etc.
AFAIK, these are client-side scripts.

<cbutler@nospaam.cbjd.net> wrote in message
news:39e2bf2f.61277274@news-server...
> I've tried to setup the most recent version of ActivePerl 5.6 on a brand
> new WinNT 4.0 webserver 128Mb RAM, SP4, IIS4.0.
>
> The PerlScript examples included with the release worked on the server but
> would not work on a browser on a workstation accessing the webserver.
>
> Thinking that security setup might be a problem, I checked the settings
for
> the Perl directory.  Everyone had "full control".  I reset the directory
> and subdirectories to give Everyone "full control".  PerlScript then
ceased
> to function on a browser on the server.
>
> The install notes for Perl for IIS 4.0 were followed (ie. application
> mappings were set and Path was correct).
>
> Any ideas on what I need to do to get PerlScript to run on a NT 4.0
> webserver?
>



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

Date: Sat, 7 Oct 2000 17:04:43 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: ANNOUNCE: GD::Graph 1.33
Message-Id: <stuntbh0eonq06@corp.supernews.com>

I have uploaded GD::Graph 1.33 to PAUSE. It should arrive at your local
CPAN shortly.

What is GD::Graph:

NAME
       GD::Graph - Graph Plotting Module for Perl 5

SYNOPSIS
       use GD::Graph::moduleName;

DESCRIPTION
       GD::Graph is a perl5 module to create charts using the GD
       module.  The following classes for graphs with axes are
       defined:

       `GD::Graph::lines'
           Create a line chart.

       `GD::Graph::bars'
           Create a bar chart.

       `GD::Graph::points'
           Create an chart, displaying the data as points.

       `GD::Graph::linespoints'
           Combination of lines and points.

       `GD::Graph::area'
           Create a graph, representing the data as areas under a
           line.

       `GD::Graph::mixed'
           Create a mixed type graph, any combination of the
           above. At the moment this is fairly limited. Some of
           the options that can be used with some of the individ­
           ual graph types won't work very well. Multiple bar
           graphs in a mixed graph won't display very nicely.

       Additional types:

       `GD::Graph::pie'
           Create a pie chart.

Changes since 1.32

(mainly for the emulation of error bars, see samples 1-7 and 6-3)

- Addition of undef as a data set colour.
- Addition of bar_width option

Changes since 1.30

- Various small bug fixes
- Finalised code for value display
- Added FAQ to distribution
- Added experimental support for hotspots

Also see file CHANGES in distribution.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | In the fight between you and the
Commercial Dynamics Pty. Ltd.   | world, back the world - Franz Kafka
NSW, Australia                  | 




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

Date: 7 Oct 2000 04:01:30 GMT
From: "Josiah" <jdb@wcoil.com>
Subject: ANNOUNCE: Lingua::EN::Dict v0.20 beta
Message-Id: <stuns7n4vukpfc@corp.supernews.com>

Greets perlfolk,

This is to announce the BETA release of:

    Lingua::EN::Dict v0.20

Recomended download URL:
http://www.josiah.countystart.com/modules/get.pl?dict:clpa

This file has also entered the CPAN as:

  file: $CPAN/authors/id/J/JB/JBRYAN/Lingua-EN-Dict-0.20.zip
size: 88914 bytes
 md5: 6566bd7f410f3111b1e41088836fc489


**NAME:

Lingua::EN::Dict - BETA Version of XML english dictionary storage.

**SYNOPSIS:

 use Lingua::EN::Dict;

 my $dict = Lingua::EN::Dict->new('words.xml');
 my $part_of_speech = $dict->type('abash');
 my $verb_tense = $dict->tense('zoomed');
 my $flag1 = $dict->is_verb('utilizes');
 my $flag2 = $dict->is_verb('utilized');
 my $flag3 = $dict->is_verb('utilizing');
 my @synonyms = $dict->syns('dictate');
 my @antonyms = $dict->opps('valid');
 my $defenition = $dict->defn('vindicate');

 undef $dict;
 $dict = Lingua::EN::Dict->new(
  server  => e.tdcj.com
  port  => 7778,
 }
 # defaults to local file 'words.xml' if it
 # cannot reach server.
 # everything in first paragraph works here too

 undef $dict;
 $dict = Lingua::EN::Dict->new(
  server  => localhost
  port  => 7778,
 }
 # everything in first paragraph works here too

 undef $dict;
 $dict = Lingua::EN::Dict->new;
    # same as above consructor, defaults to local file
    # 'words.xml' if it cannot reach server.
 # everything in first paragraph works here too

**DESCRIPTION

Note: BETA VERSION.

This is a small module I came up with to use as a storage format for
my humble attempt at a natural language parser (or a subset of natural
language - english that is). This is a seperate module that stores
the words in an xml-format file. With the distribution file, you
should have received an XML file called 'words.xml' that contains almost
3000 words consiting of several hundred verbs (not counting the seperate
forms of each of the verbs), as well as several hundred nouns, and
adjectives, articles, and modals. This module was created for the
storage and retrieval of words from the XML file.

The main reason for the beta relerase of this module is this: I would
like any and all feedback on the TCP server setup that I have added
to this module.

I often got fed-up with having to wait 20 - 40 seconds for the new()
constructor to load and parse the entire 590k of words just to run a
simple 2 line test script. And since I like to tweek and run, tweek
and run (the life of a Perl programmer, eh? :-), it was really annoying
to have to wait 30 seconds for each test to run, when the actual test
script took less than 50ms to run.  Sooooo... I added a simple TCP transfer
setup for the dictionary.

To invovke a server process for the dictionary, simply use this one-liner:

% perl -MLingua::EN::Dict -e daemon

daemon() is a function automatically exported by this module for just this
purpose. It binds a TCP server to port 7778, accepting input from any IP
address and loads the file 'words.xml' into a dictionary object for
serving.

To create a client for this server, simply use:

 my $dict = new Lingua::EN::Dict;

This automatically tries to connect to the server on port 7778 of '
localhost'. If it cannot connect to the server, it emits a warning
and proceeds to try to load the default file 'words.xml'.

The reason I released this beta version was to get input from those of
you who might have some idea of how to make sure I don't leave any
security holes in the TCP server portion.


Regards,

--
Josiah Bryan
jdb@wcoil.com







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

Date: Sat, 07 Oct 2000 17:49:45 GMT
From: [ jargoone ] <jargoone@hotmail.com>
Subject: Re: Autologin script
Message-Id: <8rnnno$gg2$1@nnrp1.deja.com>

In article <8rl6c4$lln$1@nnrp1.deja.com>,
  hurricane_number_one@my-deja.com wrote:
> Is there a simplier way to do it through Perl without having to use
> Expect?

yes.  you could duplicate what expect does, which is basically black
magic, in perl.  but you probably wouldn't want to do that.  and it
certainly wouldn't be simpler.

--
--jgn


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


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

Date: Sat, 7 Oct 2000 17:10:45 +0100
From: Rosemary I H Powell <rosie@dozyrosy.plus.com>
Subject: Best definition of Perl so far in 19100
Message-Id: <MPG.144942fa6e1d490b9896e1@usenet.plus.net>

1) What is CGI?
CGI (or Perl) is a specail Internet language that allows you
to run 'programs'.....

2) What is it useful for?
Perl is EXTREMELY useful. It's main purpose is to add
interactivity to a website.....

(found at http://members.freshhosting.co.uk/kb/cgi.html)

Just in case any of you old Perl "gurus" believed differently.

Rosemary

-- 
----------------------------------------------------------------
| Rosemary I.H.Powell  EMail: Home: rosie@dozyrosy.plus.com    |
|                             Work: r.i.h.powell@rl.ac.uk      |
|                       http://NeedleworkSamplers.com/         |
|                       http://www.CavalierKingCharles.com/    |
----------------------------------------------------------------


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

Date: Sat, 07 Oct 2000 08:55:42 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How do I get a cgi script to load a url
Message-Id: <39DF477E.44091D94@vpservices.com>

Larry Rosler wrote:
> 
> In article <39DE8068.47A0DF3F@vpservices.com>, jeff@vpservices.com
> says...
> > Mario wrote:
> 
> ...
> 
> > > Try this:
> > > print "Location:http://www.bbc.com\n";
> >
> 
>   4) You didn't put the required space after the colon.

LOL, I actually had that in as number four, but when I checked the specs
(CGI 7.2.1.1 and HTTP 4.2), they did not, that I could find, mention the
space as required.  That surprised me greatly.  Perhaps I misread, if so
please correct me.  ... cue Alan.

-- 
Jeff


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

Date: Sat, 7 Oct 2000 18:29:56 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: How do I get a cgi script to load a url
Message-Id: <Pine.GHP.4.21.0010071810150.10719-100000@hpplus03.cern.ch>

On Sat, 7 Oct 2000, Jeff Zucker wrote:

> >   4) You didn't put the required space after the colon.
> 
> LOL, I actually had that in as number four, but when I checked the specs
> (CGI 7.2.1.1 and HTTP 4.2), they did not, that I could find, mention the
> space as required.
[...]
>  ... cue Alan.

You rang?

So you actually read the specs, but didn't bother to paste the
relevant bits into your posting.  Harumph.

RFC2616, which specifies HTTP protocol, seems very clear and explicit:

 The field value MAY be preceded by any amount of LWS, though a single
 SP is preferred. 

I.e white space is not required, but it's recommended to use a single
space character.

The draft CGI RFC,
http://www.golux.com/coar/cgi/draft-coar-cgi-v11-03-clean.html#7.2
exhibits a very similar generic syntax, and says:

 The header fields are either CGI header fields to be interpreted by
 the server, or HTTP header fields to be included in the response
 returned to the client if the request method is HTTP.

reminding us of the subtle difference between an HTTP response (from a
server to a client) and a CGI response (from a CGI script to a server,
which may in due course result in the server producing an HTTP
response to the client).  Sorry to hammer on about that, but in spite
of the intentional similarities, there are times when the distinction
is critical, even if you can most of the time get away with ignoring
it.

Anyhow, the syntax in this regard is the same, although I don't see it
spelled out so explicitly.

My conclusion: the absence of any white space isn't actually wrong,
but a single space character between the ':' and the first token is
recommended.

The original NCSA spec said only that the CGI header format was the
same as HTTP header format: its actual examples all had a single space
after the colon, but it said nothing about whether this was definitive
or merely illustrative.

I've no particular knowledge of bugs that might be provoked by
disregarding the recommendation.

cheers

-- 

  You have to understand that when it comes to the web, you aren't 
  working your way up to having 100% of the visitors being able to 
  view your site, you are starting at 100% and working your way down...
                                     -  Tony L. Svanstrom




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

Date: Sat, 07 Oct 2000 13:53:46 -0400
From: brian d foy <brian+usenet@smithrenaud.com>
Subject: Re: How do I get a cgi script to load a url
Message-Id: <brian+usenet-71A402.13534607102000@news.panix.com>

In article <39DF477E.44091D94@vpservices.com>, Jeff Zucker 
<jeff@vpservices.com> wrote:

> LOL, I actually had that in as number four, but when I checked the specs
> (CGI 7.2.1.1 and HTTP 4.2), they did not, that I could find, mention the
> space as required.  

you are referring to section numbers in unspecified versions
of those specifications, perhaps? ;)

the relevant links are in the CGI Meta FAQ however.

-- 
brian d foy
Perl Mongers <URL:http://www.perl.org>
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Sun, 08 Oct 2000 01:52:33 +1000
From: Geoff Toogood <geoff@brainstorm.net.au>
Subject: how to include and execute a sub routine from another perl script
Message-Id: <B60583E1.C32%geoff@brainstorm.net.au>

Is it possible to include a sub routine from another perl library file in
your perl script.


ie.

script_1.pl
-----------

#!path/to/perl

sub print {

print "HI WORLD";

}



script_2.pl
-----------

#!path/to/perl

#compile the sub routines in script_1.pl into this script some how...

&print;

exit;



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

Date: 07 Oct 2000 10:50:43 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: how to include and execute a sub routine from another perl script
Message-Id: <877l7kk5v0.fsf@limey.hpcc.uh.edu>

>> On Sun, 08 Oct 2000 01:52:33 +1000,
>> Geoff Toogood <geoff@brainstorm.net.au> said:

> Is it possible to include a sub routine from another
> perl library file in your perl script.

perldoc -f require
perldoc -f use
perldoc perlmod

hth
t
-- 
Namaste!
And an "oogabooga" to you too!
                                         -- Homer Simpson


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

Date: Sat, 07 Oct 2000 15:58:32 GMT
From: richard.lippmann@sprachtheorie.de (Richard Lippmann)
Subject: Re: how to pass info to a script?
Message-Id: <39e847a7.25868296@news.franken.de>

On Mon, 9 Oct 2000 01:26:38 +1000, "Duoc B T"
<duocbtNOSPAM@pacific.net.au> wrote:

>i call topframe.pl with a command like this:
>
>src="topframe.pl/$who"
>
>i want to pass the value of $who to topframe.pl, which output the page for
>the top frame. it doesn't work. please help. thank you.

"topframe.pl/$who" would be expanded to "topframe.pl/richard" and
there is no file like that. You want something like this

src="topframe.pl $who"

$who is a parameter to the program.
Cu
Horshack


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

Date: 07 Oct 2000 09:59:47 -0700
From: John Salmon <jsalmon@thesalmons.org>
Subject: modifying elements in an each() loop
Message-Id: <m34s2oege4.fsf@gw.thesalmons.org>


man perlfunc says:

     each HASH
     <snip>
        If
        you add or delete elements of a hash while you're
        iterating over it, you may get entries skipped or
        duplicated, so don't.

Does modification of an existing entry constitute adding/deleting that
entry, or is is something else.  In other words, can I safely do the
following:

while( ($k, $v) = each(%h) ){
    $h{$k} = &something_new($v);
}

Is it safe with hashes tied to DB_File or other external databases?

Thanks,
John Salmon


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

Date: Sat, 07 Oct 2000 20:06:40 +0200
From: Andrea Novara <andrea@defiant.stru.it>
Subject: MySQL BLOB types and DBD::mysql
Message-Id: <39DF6630.16D748DC@defiant.stru.it>

I hope that's the right place to post such a question otherwise I
apologize in advance.

I have a MySQL server handled by perl CGI scripts. In such a script I
have to upload
data in a MEDIUMBLOB column. MySQL server ends connection with perl with
a message
like this:

DBD::mysql::st execute failed: MySQL server has gone away at
/www/cgi-bin/stru.pl line 29.

I have also tried to bind the var to the placeholder using
SQL_LONGVARBINARY type
but that don't helped solve the problem.

The deamon just accept first 1045000 bytes or so and than disconnect!!!

Anyone have a suggestion, please?

Many thanks in advance!!

Andrea



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

Date: Sat, 7 Oct 2000 16:38:42 +0100
From: "Stuart Moore" <stumo@bigfoot.com>
Subject: Re: Netscape supports Perl ?
Message-Id: <drHD5.20066$L12.404080@news2-win.server.ntlworld.com>

Pratibha Sundarmurthy <Pratibha.S@in.bosch.com> wrote in message
news:8rjjs2$p8p$1@proxy.fe.internet.bosch.de...
> Hello,
>     I am using ActiveState's Activeperl to develop ASP pages.
> The pages don't work on netscape...does anyone know if anything has to be
> installed/copied to work with netscape ?
>     any info is appreciated.

If IE is handling the page correctly but NS isn't, it's probably because you
haven't set the content type correctly - NS is more touchy about this than IE. I
usually use the CGI module for convenience, so at the top of mine I have:

use CGI;

my $cgi=new CGI;

print $cgi->header();


CGI.pm is included with activeperl, and has a lot of other useful stuff too.

Stuart




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

Date: Sat, 07 Oct 2000 14:59:47 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Not Entirely On Topic:  Programming and math
Message-Id: <39DF5F5F.F90E07C3@netstorm.net>

Stan Rydz wrote:
> 
> "Lou Moran" <lmoran@wtsg.com> wrote in message
> news:35eptscl81drjr8gn9teh5ol2a2p00gcql@4ax.com...
> > --Is a strong background in mathematics (not arithmetics) mandatory
> > for a successful career as a programmer?
> >
> > --Could a creative (musician/writer/painter/whatever) person become a
> > "real" (read useful/good/paid) programmer without having mathematical
> > prowess?
> >
> 
> I have heard or read (maybe in a book called " The Psychology of Computer
> Programming" by Gerald Weinberg) that a musical backgrounds is a good (if
> not only) predictor of programming ability.
> 

Quite a few years back I read an article in Fortune or a similar
magazine about a company that was retraining employees for the "new
economy" and discovered that people with a background in music made
quite good programmers. I took note because I had a musical background.

-- Jim


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

Date: Sat, 07 Oct 2000 09:06:44 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Please Help nightmare running rel script.
Message-Id: <39DF4A14.283F373A@vpservices.com>

Ian wrote:
>
> [big snip]
> 
> while(defined($a=<MYFILE>))
>   {
>     chomp ($a);

Clay and Eric pointed out a number of other problems which need
addressing and this one is perhaps minor compared to them, but you
should avoid the use of $a (and $b) as variable names, see "perldoc -f
sort" for why.

-- 
Jeff


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

Date: Sat, 07 Oct 2000 13:05:51 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Please help on "processing data problem"
Message-Id: <39DF44AC.7BC5E69A@netstorm.net>

tvn007@my-deja.com wrote:
> 
> Hi
> 
> Would someone please help me on this:
> 
> The problem is : I must replace 1 or 0 with a character 'X' on the
> previous row if the character of the next row is 'L' or 'H'
> 
> As an Example:
> 
> I have a big file (this is just small sample) as shown below:
> 
> abc
> (XF_S  1
> (XF_S  0
> (XF_S  L
> (XF_S  H
> 
> I would like to have the ouput as follow:
> 
> abc
> (XF_S  1
> (XF_S  X
> (XF_S  L
> (XF_S  H
> 
> THe script I wrote does not give me the output I want:
> 
> #!/usr/local/bin/perl5
> 
> $input_file = $ARGV[0];
> open (FD,$input_file)|| die "cannot open";
> 
> $output_file = 'output';
> 
> open (LVMADR,">$output_file")|| die "cannat opne";
> 
>         while ($line = <FD>){
>                 chomp $line;
> 
>         if ($line =~ /^\(XF_S/){
>                 $char = substr ($line,7,1); }
> 
>         if (($char =~/H|L/) && ($previous_char =~ /1|0/)){
> 
>                 substr($line,7,1) = 'X';}
> 
>                         if ($line =~ /^\(XF_S/){
>                                 $previous_char= substr ($line,7,1);
>                         }
> 
>                 print "$line\n";
>         }
> 
> Below is the output from my script:
> 
> abc
> (XF_S  1
> (XF_S  0
> (XF_S  X
> (XF_S  H
> 

Here's as short as I can make it.  You can make adjustments for opening
and closing files, etc.

while (<DATA>) {
   print;
   if (/0$/) {
      $line=<DATA>;
      $line=~s/[LH]$/X/ and print $line or $_=$line,redo;
   }
}

__DATA__
abc
(XF_1  1
(XF_2  0
(XF_3  0
(XF_4  L
(XF_5  H



-- Jim


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

Date: Sat, 07 Oct 2000 13:23:22 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Please help on "processing data problem"
Message-Id: <39DF48CA.88895D82@netstorm.net>

Jim Mauldin wrote:
>  
> Here's as short as I can make it.  You can make adjustments for opening
> and closing files, etc.
> 
> while (<DATA>) {
>    print;
>    if (/0$/) {
>       $line=<DATA>;
>       $line=~s/[LH]$/X/ and print $line or $_=$line,redo;
>    }
> }
> 

Aaarg!  I did exactly the opposite of what you want and forget about
[01].  Try this:


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

Date: Sat, 07 Oct 2000 13:25:55 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Please help on "processing data problem"
Message-Id: <39DF4960.259D37B7@netstorm.net>

Jim Mauldin wrote:
>  
> Here's as short as I can make it.  You can make adjustments for opening
> and closing files, etc.
> 
> while (<DATA>) {
>    print;
>    if (/0$/) {
>       $line=<DATA>;
>       $line=~s/[LH]$/X/ and print $line or $_=$line,redo;
>    }
> }
> 

Aaarg!  I did exactly the opposite of what you want and forgot about
[01].  Try this:

while (<DATA>) {
   if (/[01]$/) {
      $line=<DATA>;
      if ($line=~/[LH]$/) {
         s/.$/X/;
         print $_,$line;
      } else {
         print;
         $_=$line;
         redo;
      };
   } else {print}
}

-- Jim

__DATA__
abc
(XF_1  1
(XF_2  0
(XF_3  0
(XF_4  L
(XF_5  H


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

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


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