[22300] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4521 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 6 11:09:58 2003

Date: Thu, 6 Feb 2003 08:06:44 -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           Thu, 6 Feb 2003     Volume: 10 Number: 4521

Today's topics:
        'Flatten' array of phrases (maybe)
    Re: 'Flatten' array of phrases <uri@stemsystems.com>
        a few newbie questions... <nickyboy@4ce.co.uk>
    Re: a few newbie questions... (Tad McClellan)
    Re: ActivePerl distro. whatNext <noemail@nowhere.net>
        different autoreply after submitting form <vanlare@zeelandnet.nl>
    Re: different autoreply after submitting form (Tad McClellan)
    Re: different autoreply after submitting form <vanlare@zeelandnet.nl>
        Extract email attachment filenames <elacour@home-dn.net>
        File question in perl...Please help (Mehul)
    Re: File question in perl...Please help <jurgenex@hotmail.com>
        Installing a module downloaded from CPAN <brian.smart@blueyonder.co.uk>
    Re: Optimizing subroutine <pinyaj@rpi.edu>
        Perl scripts utilizing Openview Omniback commands (Kevin)
    Re: Perl scripts utilizing Openview Omniback commands (Tad McClellan)
    Re: Q on Guttman-Rosler <kj345@lycos.com>
    Re: Regex Multiple occurances of a pattern in multiple  <josef.moellers@fujitsu-siemens.com>
    Re: Regex Multiple occurances of a pattern in multiple  (Tad McClellan)
        Script Problem - PLEASE help <stuandju@NOSPAMaberhonddu1.fsnet.co.uk>
    Re: Splitting data into variables <Geezer@Freezer.com>
    Re: Splitting data into variables <bernard.el-hagin@DODGE_THISlido-tech.net>
    Re: Splitting data into variables <Geezer@Freezer.com>
        Splitting lines from a temporary buffer <knewman00@earthlink.net>
    Re: string in datei <ubl@schaffhausen.de>
    Re: string in datei <nobody@dizum.com>
    Re: string in datei (Ben Morrow)
    Re: string in datei (Tad McClellan)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 6 Feb 2003 15:53:45 -0000
From: Jacqui or (maybe) Pete <porjes@spamcop.net>
Subject: 'Flatten' array of phrases
Message-Id: <MPG.18ac9569b70d0d59897c3@news.CIS.DFN.DE>

I've got a large array of words and phrases. Some of the phrases are 
partially duplicated, and I want to remove the duplications.  I've got a 
big clunky loop that does the job, but I figure there must be a smarter 
and more perl-like way of doing it.  

Example:

about minutes
according
according the
according the times
according the times herald
according the times herald record
add
add cooked
add recipe
add recipe box
add salt
add some

Should be flattened to:

about minutes
according the times herald record
add cooked
add recipe box
add salt
add some

All advice gratefully received.
-- 
Your site's most important visitors are completely blind, 
totally deaf, and use browsers you've never seen. 


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

Date: Thu, 06 Feb 2003 16:01:42 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: 'Flatten' array of phrases
Message-Id: <x7of5pjt3u.fsf@mail.sysarch.com>

>>>>> "JoP" == Jacqui or (maybe) Pete <porjes@spamcop.net> writes:

  JoP> I've got a large array of words and phrases. Some of the phrases
  JoP> are partially duplicated, and I want to remove the duplications.
  JoP> I've got a big clunky loop that does the job, but I figure there
  JoP> must be a smarter and more perl-like way of doing it.

show your code.

  JoP> according
  JoP> according the
  JoP> according the times
  JoP> according the times herald
  JoP> according the times herald record
  JoP> add
  JoP> add cooked

  JoP> Should be flattened to:

defined 'flattened' in very specific terms. empirical examples are
usually not a source for code design.

  JoP> add cooked
  JoP> add recipe box
  JoP> add salt
  JoP> add some

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class


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

Date: Thu, 6 Feb 2003 15:18:16 -0000
From: "nickyboy" <nickyboy@4ce.co.uk>
Subject: a few newbie questions...
Message-Id: <Y0v0a.14391$RZ.162001@newsfep4-win.server.ntli.net>

Hi
I'm currently stuck with a php project and I think perl is the way around
it...

Firstly I want to be able to run a script as a different user from that
assigned to apache, I've been told that simply running
www.domain.com/~mike/script.pl will run the script as mike (assuming that's
all setup correctly)...  I can't just run php from there because apache just
runs the script as it normally would and doesn't see the different user! :(
will that work?

Assuming that will work I need to start learning perl, what is the official
site / good site with documentation, to start with I simply need to get a
few variables from a form, and pass that to the shell to run the odd
command - any help / ideas / tutorials would be really helpful, I've got
what I'm trying to do in php, so kinda know the basic way around it but seem
to be struggling for suitable resources.

Tia
Nick





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

Date: Thu, 6 Feb 2003 09:48:01 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: a few newbie questions...
Message-Id: <slrnb450th.ebb.tadmc@magna.augustmail.com>

nickyboy <nickyboy@4ce.co.uk> wrote:

> Subject: a few newbie questions...
                 ^^^^^^

Consider not including that word in your Subject, it decreases
the readership for your postings.

Have you seen the Posting Guidelines that are posted here frequently?


> I'm currently stuck with a php project and I think perl is the way around
> it...


Actually, any CGI program, whether written in Perl or in some
other language, is a potential way around it.


> Firstly I want to be able to run a script as a different user from that
> assigned to apache, I've been told that simply running
> www.domain.com/~mike/script.pl will run the script as mike (assuming that's
> all setup correctly)...  I can't just run php from there because apache just
> runs the script as it normally would and doesn't see the different user! :(
> will that work?


None of the above has anything to do with Perl. It has to do
with web server setup, so you should ask that part in a group
where such things are discussed, such as:

      comp.infosystems.www.servers.mac
      comp.infosystems.www.servers.misc
      comp.infosystems.www.servers.ms-windows
      comp.infosystems.www.servers.unix
      comp.infosystems.www.authoring.cgi
      alt.apache.configuration


> Assuming that will work I need to start learning perl, what is the official
> site 

   www.perl.org
   www.perl.com
   lists.perl.org


> / good site with documentation, 


The "official" documentation is included with the perl distribution
itself. If you have installed perl, then it is already on your
hard disk somewhere. The Posting Guidelines mention how to get
started with the std docs.


> to start with I simply need to get a
> few variables from a form, and pass that to the shell 


Warning Will Robinson!

There is extreme danger there, you better be really really careful
and know exactly what you're doing. Crackers salivate for the
situation you describe above. If you put it on a publically
available web site, sooner or later they will find it...

   perldoc perlsec

will help with some of that.

   perldoc -q CGI

      "Where can I learn about CGI or Web programming in Perl?"

      "How do I make sure users can't enter values into a form 
       that cause my CGI script to do bad things?"

are likely to be helpful as well.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 6 Feb 2003 14:32:45 GMT
From: nobody <noemail@nowhere.net>
Subject: Re: ActivePerl distro. whatNext
Message-Id: <Xns931A618E7DE0Eabccbaabc@129.250.170.100>

> ... Ok.. got that fiexed and installed the program..
> great.. State | Programs | ActievePerl | Pakage Manager which opend
> a ppm> prompt.. what I am suppoe to do.. where I am going with
> this.. the documnetations under ActivePerl looks nice and colorfull
> not no good tutourial on where to go from here.. 

PPM (the package manager) is for installing more Perl packages 
(libraries). Ignore it for now.

To start experimenting with Perl, open a cmd window (DOS) and
try the following:

   perl -e "print 'Hello World!'"

If that doesn't work, then something's wrong - 
probably the perl bin dir is not in your path.

Once that works, read the documentation and have fun.
The first step might be to learn how to run a script that's
in a file. 
 
  perl myscriptfile.pl

Be sure to put "use strict;" and "use warnings;" at the top.




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

Date: Thu, 6 Feb 2003 15:49:52 +0100
From: "Marchal van Lare" <vanlare@zeelandnet.nl>
Subject: different autoreply after submitting form
Message-Id: <3e427610$0$30066$fb624cd1@news1.zeelandnet.nl>

Hello,

Is it possible to let a script send out a different autorespond to the user
of a form,
(in other words, sending a different message depending on what the user has
chosen
in a form?)

Can someone tell me on how to achieve this? Online doc's are welcome also.

Thanks in advance!

Marchal




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

Date: Thu, 6 Feb 2003 09:24:58 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: different autoreply after submitting form
Message-Id: <slrnb44via.e80.tadmc@magna.augustmail.com>

Marchal van Lare <vanlare@zeelandnet.nl> wrote:
> 
> Is it possible to let a script send out a different autorespond to the user
> of a form,
> (in other words, sending a different message depending on what the user has
> chosen
> in a form?)


What, exactly, are you wanting to do?

You say "autoreply" and "autorespond" and "message" and it is
not clear what you mean by any of them.

Do you want to send email?

Do you want to output some HTML?

Since you mention "form", I will assume that you are speaking of
a CGI program that will output different HTML based on a submited
form value.


> Can someone tell me on how to achieve this? 

   if ( param('selector') eq 'plain_output')
      { make_output() }
   else
      { make_fancy_output() }


> Online doc's are welcome also.


   perldoc -f print


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 6 Feb 2003 16:45:33 +0100
From: "Marchal van Lare" <vanlare@zeelandnet.nl>
Subject: Re: different autoreply after submitting form
Message-Id: <3e42831e$0$30070$fb624cd1@news1.zeelandnet.nl>

Tad,

When someone submits a form, I want the output to be e-mailed to me,
while the submitter receives an automatic reply (with confirmation of the
information being submitted, also by e-mail).

Is it possible to let the CGI program send out a reply, depending
on what the submitter has chosen in the form?

For example the following form:

Name:
Email adres:

Select one of the following products (selection menu)
-Product 1
-Product 2
-Product 3
-Product 4
-Product 5

If the submitter has chosen Product 1, the reply mail has more information
about Product 1, if Product 2 has been chosen, then the submitter receives
more information about Product 2 etc.

I hope it is clear to you know.

Thanks in advance

Regards, Marchal van Lare
"Tad McClellan" <tadmc@augustmail.com> schreef in bericht
news:slrnb44via.e80.tadmc@magna.augustmail.com...
> Marchal van Lare <vanlare@zeelandnet.nl> wrote:
> >
> > Is it possible to let a script send out a different autorespond to the
user
> > of a form,
> > (in other words, sending a different message depending on what the user
has
> > chosen
> > in a form?)
>
>
> What, exactly, are you wanting to do?
>
> You say "autoreply" and "autorespond" and "message" and it is
> not clear what you mean by any of them.
>
> Do you want to send email?
>
> Do you want to output some HTML?
>
> Since you mention "form", I will assume that you are speaking of
> a CGI program that will output different HTML based on a submited
> form value.
>
>
> > Can someone tell me on how to achieve this?
>
>    if ( param('selector') eq 'plain_output')
>       { make_output() }
>    else
>       { make_fancy_output() }
>
>
> > Online doc's are welcome also.
>
>
>    perldoc -f print
>
>
> --
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas




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

Date: Thu, 6 Feb 2003 14:58:54 +0000 (UTC)
From: Emmanuel Lacour <elacour@home-dn.net>
Subject: Extract email attachment filenames
Message-Id: <slrnb44u1c.ctu.elacour@pavot.easter-eggs.fr>


Could anyone give me an example on how to do this (probably using
MIME::Parser)?


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

Date: 6 Feb 2003 07:16:13 -0800
From: mehul111@yahoo.com (Mehul)
Subject: File question in perl...Please help
Message-Id: <e743165d.0302060716.42bbc0d7@posting.google.com>

Hi,
   I want to modify a text file ( which is an input for some other
script ) in my perl script. How do I check if the file is in use by
that other script or not, so that I don't modify that text file while
the other script is using it?


Thanks a lot,
-Mehul


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

Date: Thu, 06 Feb 2003 15:24:49 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: File question in perl...Please help
Message-Id: <57v0a.3713$5g7.1031@nwrddc02.gnilink.net>

Mehul wrote:
>    I want to modify a text file ( which is an input for some other
> script ) in my perl script. How do I check if the file is in use by
> that other script or not, so that I don't modify that text file while
> the other script is using it?

By implementing file locking? That's a standard technique that is not
specific to Perl in any way.
Please see "perldoc -q lock" for further details.

jue




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

Date: Thu, 6 Feb 2003 16:00:15 -0000
From: "Brian Smart" <brian.smart@blueyonder.co.uk>
Subject: Installing a module downloaded from CPAN
Message-Id: <Cvv0a.4075$Ra1.2627@news-binary.blueyonder.co.uk>

Hello Everybody,
I have read everything I can including the Faqs but can't seem to get things
right.
I have downloaded a modual, placed it in my cgi-bin directory on the web
server I use (UNIX), have unpacked it and tried to run the code perl
Makefile.PL PREFIX=../../cgi-bin. Makefile runs until it tries to download
and unpack another module from CPAN that is needed to complete the
installation. This stops with the error message:

Could not gzopen
y/sources/authors/id/I/IL/ILYAZ/modules/Math-Pari-2.010305.tar.gz at
/usr/lib/perl5/5.00503/CPAN.pm line 4159

Could somebody explain what this message is about, and what if anything I am
doing wrong.

Thanks for your help.

Brian Smart






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

Date: Thu, 6 Feb 2003 09:41:14 -0500
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
To: Dimitri <mauroid@csi.forth.gr>
Subject: Re: Optimizing subroutine
Message-Id: <Pine.SGI.3.96.1030206094029.68431A-100000@vcmr-64.server.rpi.edu>

[posted & mailed]

On 6 Feb 2003, Dimitri wrote:

>sub clean_ctrl {
>    my ($data) = @_;
>    my ($i);
>    my $len = length($data);
>    my $out = "";
>
>    for ($i = 0; $i < $len; $i += 2) {
>        if (ord(substr($data, $i, 1)) < 128) {
>            $out .= substr($data, $i, 2);

Why does this work two characters at a time?  Can you be CERTAIN that you
won't get a string with an even-placed control character?

>        } else {
>            $out .= sprintf("%02x", ord(substr($data, $i + 1, 1)));
>        }
>    }
>
>    $out;
>}

-- 
Jeff Pinyan            RPI Acacia Brother #734            2003 Rush Chairman
"And I vos head of Gestapo for ten     | Michael Palin (as Heinrich Bimmler)
 years.  Ah!  Five years!  Nein!  No!  | in: The North Minehead Bye-Election
 Oh.  Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)



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

Date: 6 Feb 2003 07:40:32 -0800
From: kevin_mudd@adp.com (Kevin)
Subject: Perl scripts utilizing Openview Omniback commands
Message-Id: <bf26a3a6.0302060740.36947024@posting.google.com>

Hello group,

I've been assigned the task of incorporating Omniback commands into
perl scripts.  Was wondering if anyone here has done the same and
could help me get started.

Thanks, 
Kevin


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

Date: Thu, 6 Feb 2003 09:58:40 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl scripts utilizing Openview Omniback commands
Message-Id: <slrnb451hg.ed3.tadmc@magna.augustmail.com>

Kevin <kevin_mudd@adp.com> wrote:
> 
> I've been assigned the task of incorporating Omniback commands into
> perl scripts.  

> Was wondering if anyone here has done the same and
> could help me get started.


Searching for "Omniback" in the "comp.lang.perl.*" newsgroups at:

   http://groups.google.com/advanced_group_search

finds 2 threads about it.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 6 Feb 2003 15:48:44 +0000 (UTC)
From: kj <kj345@lycos.com>
Subject: Re: Q on Guttman-Rosler
Message-Id: <b1u04s$ecc$1@reader1.panix.com>

In <3E41AAB4.E19E950F@earthlink.net> Benjamin Goldberg <goldbb2@earthlink.net> writes:

>Try this:

>   BEGIN {
>      8 == length pack 'd'
>         or die "Expected double length to be 8";
>   }
>   use constant BIGENDIAN => pack('N', 1) eq pack('L', 1);
>   my $i = 0;
>   my @sorted =
>      grep substr($_, 0, index($_, "\t", 8)-1, ++$i),
>      sort
>      map {
>         my $n = (split /\t/, $_, 6)[5];
>         (BIGENDIAN ?
>            pack('d', $n) : reverse pack('d', $n))
>            ^ ($n < 0 ? "\xFF" x 8 : "\x80")) . $_
>      } @origdata;
>   __END__

>[untested]

>By avoiding subroutine calls, and because the BIGENDIAN ?...:... gets
>constant folded so only the code for one of the two branches remains,
>this *should* be faster than either of the solutions uri posted.

That's a nice optimization; it is indeed faster than the version
with the sub calls.  It had three bugs/typos that I've fixed below:

   BEGIN {
      8 == length pack 'd'
         or die "Expected double length to be 8";
   }
   use constant BIGENDIAN => pack('N', 1) eq pack('L', 1);
   my $i = 0;
   my @sorted =
      grep substr($_, 0, index($_, "\t", 8), ++$i),
      sort
      map {
         my $n = (split /\t/, $_, 6)[5];
         (BIGENDIAN ?
            pack('d', $n) : reverse pack('d', $n))
            ^ ($n < 0 ? "\xFF" x 8 : "\x80" . "\x00" x 7) . $_
      } @origdata;
   __END__

kj



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

Date: Thu, 06 Feb 2003 15:13:01 +0100
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: Regex Multiple occurances of a pattern in multiple lines
Message-Id: <3E426D6D.2F7DD5F9@fujitsu-siemens.com>

Anton wrote:
> =

> I am capuring a error message and I want to extract some info from it.
>  Unfortunately I cannot seem to get the correct syntax of regex s/ to
> extract only the information I require.  The message is something like
> =

> XXXXXXXX info '<pattern I want to keep>'
> XXXXXX info '<pattern I want to keep>'
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> =

> my attempt at the code looks like
> =

> $err_msg =3D~ s/.+?info\'(\w+)\'.+?/$1 /sg
> =

> Unfortunately this leaves me with unwanted data after the last
> <pattern I want to keep>
> =

> Thanks
> =

> Anton
> =

> Note: As per the example the error message has multiple new lines
> embedded in it, but I can't think how to use them, if at all

You might consider split-ting the data into multiple lines, then
extracting the data you want from each line.

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


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

Date: Thu, 6 Feb 2003 09:16:58 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Regex Multiple occurances of a pattern in multiple lines
Message-Id: <slrnb44v3a.e80.tadmc@magna.augustmail.com>

Anton <shianto@hotmail.com> wrote:
> I am capuring a error message and I want to extract some info from it.
>  Unfortunately I cannot seem to get the correct syntax of regex s/ to
> extract only the information I require.  The message is something like
> 
> XXXXXXXX info '<pattern I want to keep>' 
> XXXXXX info '<pattern I want to keep>' 
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> 
> my attempt at the code looks like
> 
> $err_msg =~ s/.+?info\'(\w+)\'.+?/$1 /sg
                       ^      ^
                       ^      ^ no need to escape single quotes

> Unfortunately this leaves me with unwanted data after the last
><pattern I want to keep>


It also leaves data before the "keepers".

It also leave data between the "keepers".

In fact, it leaves the entire string unchanged, since the
pattern fails to match. The pattern does not allow a space
following "info". The pattern does not allow non-word chars,
such as spaces, between the single quotes.

Is this your real code?

Please be more respectful of other people's time by posting Real Code.



Instead of using s///, use m// in a list context:

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

my $err_msg ="XXXXXXXX info '<pattern I want to keep>'
XXXXXX info '<pattern I want to keep>'
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

my $keep = join ' ', $err_msg =~ m/info '([^']+)'/g;
print "$keep\n";
-----------------------------



-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 6 Feb 2003 15:58:23 -0000
From: "Babyface" <stuandju@NOSPAMaberhonddu1.fsnet.co.uk>
Subject: Script Problem - PLEASE help
Message-Id: <b1u0n4$md0$1@news7.svr.pol.co.uk>

Are there experts who'd be willing to look at a script for me to see what
the problem is. It's the YABB discussion board script. (they are not much
help)  My web host Technical support have looked through it a number of
times but can see no reason why it wouldn't work. I have been through all
the troubleshooting bits and pieces. I havent changed any of the script
other than what I was instructed to do.

I could if anybody wished attach the .pl file the .cgi file and the latest
email from tech support on what they think it could be.

It's a big ask I know but I hope one of you might be able to help

Thank you




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

Date: Thu, 06 Feb 2003 14:09:11 +0000
From: Geezer From The Freezer <Geezer@Freezer.com>
Subject: Re: Splitting data into variables
Message-Id: <3E426C87.C6237FD8@Freezer.com>


ok got it, but when running (I'm using print to display results) it says :

Use of uninitialized value at ./uk0006exch004u.pl2 line 14.

Use of uninitialized value at ./uk0006exch004u.pl2 line 16.


here's a snippet of the code

        my ($packetloss, $roundtrip) = $data =~ m!(\d+%).*\d+/(\d+)/!;

        print "$packetloss\n";

        print "$roundtrip\n";


any ideas?


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

Date: Thu, 6 Feb 2003 14:23:04 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Splitting data into variables
Message-Id: <Xns931A9BD181A91elhber1lidotechnet@62.89.127.66>

Geezer From The Freezer wrote:

> 
> ok got it, but when running (I'm using print to display results) it
> says : 
> 
> Use of uninitialized value at ./uk0006exch004u.pl2 line 14.
> 
> Use of uninitialized value at ./uk0006exch004u.pl2 line 16.
> 
> 
> here's a snippet of the code
> 
>         my ($packetloss, $roundtrip) = $data =~ m!(\d+%).*\d+/(\d+)/!;
> 
>         print "$packetloss\n";
> 
>         print "$roundtrip\n";
> 
> 
> any ideas?
 

What exactly is in $data? You didn't get a match.


BTW, you snipped too much from what you're replying to. I don't even 
remember what your OP was.


-- 
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'



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

Date: Thu, 06 Feb 2003 15:26:47 +0000
From: Geezer From The Freezer <Geezer@Freezer.com>
Subject: Re: Splitting data into variables
Message-Id: <3E427EB7.36F9E918@Freezer.com>

$data = `su username -c "rsh hostname /usr/sbin/ping -s uk0006exch004u 1472 8" |
/usr/bin/tail -2`;


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

Date: Thu, 06 Feb 2003 15:53:40 GMT
From: Kevin Newman <knewman00@earthlink.net>
Subject: Splitting lines from a temporary buffer
Message-Id: <3E428EA2.7000407@earthlink.net>

Hi all,

I'm trying to split lines from a temporary buffer.  The steps are:
1. Read in a chunk of data to a buffer from a file
2. Split to some terminator
3. Then substitute nothing(?) using the value assigned from step 2
4. Refill the buffer with more data (code not shown)

But, when I try these steps the first line is split from the buffer then 
the program loops until I hit control-C (see code below). My questions 
are why does this not work and is there a better approach to creating a 
"refillable" buffer.  Any suggestions?

Thanks,

kln

use strict;
my $filename = $ARGV[0];
my $terminator = qr/\015\012|[\015\012\000]/;
	
open (DATAFILE, "$filename") || die "Could not open file $filename  $!\n";
my	 $bytes_read = read( DATAFILE,  my $buffer , 5000 );
while (1)
{
	my ($line) = split (/\n/,$buffer);
	$buffer =~ s/\Q$line//;
	print "$buffer";
}


#Sample data
line1line1line1line1line1line1line1
line2line2line2line2line2line2line2
line3line3line3line3line3line3line3
line4line4line4line4line4line4line4
line5line5line5line5line5line5line5



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

Date: Thu, 06 Feb 2003 15:33:17 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: string in datei
Message-Id: <b1tuva$9ag$1@news.dtag.de>

Alan J. Flavell wrote:

> (und wegen "datei", hat man inzwischen Grossschreiben aufgegeben?)

Obviously, most people here learned their capitalization rules from
reading perlstyle.

->malte



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

Date: Thu,  6 Feb 2003 16:00:03 +0100 (CET)
From: Nomen Nescio <nobody@dizum.com>
Subject: Re: string in datei
Message-Id: <4df03d37e75c28b8b675be62ee106745@dizum.com>


On Thursday 06 February 2003 09:37, Ben Morrow wrote:

> tadmc@augustmail.com wrote:
>>Jürgen Exner <jurgenex@hotmail.com> wrote:
>>> Ben Morrow wrote:
>>>> abigail@abigail.nl wrote:
>>>>> Huh? This isn't en.comp.lang.perl.misc.
>>>>
>>>> No, this is comp.lang.perl.misc, which is by implication
>>>> us.comp.lang.perl.misc.
>>> 
>>> No, by no means! What gave you that idea?
>>> This is a world-wide group. If you want a US-only group please feel free
>>> to create one.
>>> 
>>> It's statements like these which make Americans appear to be arrogant,
>>
>>Yep. I'm embarrassed by your attitude in this thread Ben.
> 
> OK, I'm sorry. Clearly I was out of line.
> 
> Just to make it clear: I am not American. I am English.
> 
> Again: I didn't mean either to offend or to appear to exclude anyone. I
> apologise if I gave that impression.

Trying to impose regional (language-specific) standards on a
non-regionalized group is representative of the bad kinds of
Americans. I'm sorry to see such arrogance in England too.


















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

Date: Thu, 6 Feb 2003 15:20:04 +0000 (UTC)
From: mauzo@ux-ma160-17.csv.warwick.ac.uk (Ben Morrow)
Subject: Re: string in datei
Message-Id: <b1tuf4$ig1$1@wisteria.csv.warwick.ac.uk>

Nomen Nescio <nobody@dizum.com> wrote:
>
>On Thursday 06 February 2003 09:37, Ben Morrow wrote:
>
>> tadmc@augustmail.com wrote:
>>>Jürgen Exner <jurgenex@hotmail.com> wrote:
>>>> Ben Morrow wrote:
>>>>> abigail@abigail.nl wrote:
>>>>>> Huh? This isn't en.comp.lang.perl.misc.
>>>>>
>>>>> No, this is comp.lang.perl.misc, which is by implication
>>>>> us.comp.lang.perl.misc.
>>>> 
>>>> No, by no means! What gave you that idea?
>>>> This is a world-wide group. If you want a US-only group please feel free
>>>> to create one.
>>>> 
>>>> It's statements like these which make Americans appear to be arrogant,
>>>
>>>Yep. I'm embarrassed by your attitude in this thread Ben.
>> 
>> OK, I'm sorry. Clearly I was out of line.
>> 
>> Just to make it clear: I am not American. I am English.
>> 
>> Again: I didn't mean either to offend or to appear to exclude anyone. I
>> apologise if I gave that impression.
>
>Trying to impose regional (language-specific) standards on a
>non-regionalized group is representative of the bad kinds of
>Americans. I'm sorry to see such arrogance in England too.

It was not arrogance. I was under the impression that discussions in the 
non-regional groups were conventionally carried out in English. It seems
sensible to me that there should be a group for discussion of Perl in English, 
a group in German, a group in French, &c. That the English group happens to be
called comp.lang.perl.misc rather than en.comp.lang.perl.misc I would have put
down to historical accident.

It seems I was mistaken. I apologise. Please ignore everything I have said in
this thread.

Ben

[If I have been less than clear, and thus seemed to be wishing to exclude 
people who could not speak English from Usenet, I can only say that that was
not in any way my intention. Blame it on the fact that I've just been put on
different anti-depressants and am feeling... rather weird. Yes, there is a good
case for saying 'in that case, don't post to Usenet'... ]



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

Date: Thu, 6 Feb 2003 09:18:15 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: string in datei
Message-Id: <slrnb44v5n.e80.tadmc@magna.augustmail.com>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Helgi Briem <helgi@decode.is> wrote in comp.lang.perl.misc:
> 
>> I could post questions here in Icelandic all day
> 
> That would make clpm a still thornier place...


I'd probably try rot13'ing it and then give up.  :-)


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

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


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