[17231] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4653 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 18 14:10:48 2000

Date: Wed, 18 Oct 2000 11:10:22 -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: <971892622-v9-i4653@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 18 Oct 2000     Volume: 9 Number: 4653

Today's topics:
        Perl not functioning in practice as it should in theory </michael>
    Re: Perl not functioning in practice as it should in th (Jerome O'Neil)
    Re: Perl not functioning in practice as it should in th nobull@mail.com
        Perl not functioning in practice as it should in theory </michael>
    Re: perl objects and methods (Michael Houghton)
        Perl question - Backup and email a file? <john@macleodweb.com>
    Re: Perl question - Backup and email a file? <anders@wall.alweb.dk>
    Re: Perl: Day One, a Stupid Question <jeff@vpservices.com>
    Re: Perl: Day One, a Stupid Question frannyzoo@hotmail.com
        pointing to a particular line in a file - how do you do <pauls_spam_no@pauls.seanet.com>
    Re: pointing to a particular line in a file - how do yo <ren.maddox@tivoli.com>
    Re: pointing to a particular line in a file - how do yo <ddunham@redwood.taos.com>
    Re: pointing to a particular line in a file - how do yo (Michel Dalle)
        Problem with locale and \s <julien.quint@xrce.xerox.com>
        Program design <jbarnett@axil.netmate.com>
    Re: Program design <anders@wall.alweb.dk>
    Re: Regex substitution question... (Anno Siegel)
        Rijndael in Perl (Tony L. Svanstrom)
    Re: Search, pad, replace <desquite@hotmail.com>
    Re: Search, pad, replace <jeffp@crusoe.net>
    Re: Search, pad, replace <desquite@hotmail.com>
    Re: Sort Help Needed <russ_jones@rac.ray.com>
    Re: Sort Help Needed <godzilla@stomp.stomp.tokyo>
    Re: Sort Help Needed <lr@hpl.hp.com>
    Re: split on comma except when embedded inside quotes <jalford12@yahoo.co.uk>
    Re: split on comma except when embedded inside quotes <jalford12@yahoo.co.uk>
        tie? <ducateg@info.bt.co.uk>
        weird print behaviorr <ubl@schaffhausen.de>
    Re: weird print behaviorr nobull@mail.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 18 Oct 2000 13:05:28 -0400
From: </michael>
Subject: Perl not functioning in practice as it should in theory.  - test.pl (0/1)
Message-Id: <nqlrusc47vc1109qd4tea5qno18sk1nq6n@4ax.com>

Please look at this script.  It should find every sub directory
recursively but stops for some reason.  Id anyone could figure this
out I would greatly appreciate it.  


#!/usr/bin/perl

@directory = ('/home/users/michael');

sub openDir {

   my ($ImageDir) = @_;

   opendir(LS,$ImageDir);
      @file = readdir(LS);
   closedir(LS);

   foreach $file (@file) {
      if ((-d $file)&&(!($file =~ /\./))) {
         push(@directory,"$ImageDir/$file");
         print "   Adding: $ImageDir/$file\n";
      }
   }
}

while (@directory) {
   print "Searching: $directory[0]\n";
   openDir($directory[0]);
   shift(@directory);
}



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

Date: Wed, 18 Oct 2000 17:33:01 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: Perl not functioning in practice as it should in theory.  - test.pl (0/1)
Message-Id: <h9lH5.49$wM1.50157@news.uswest.net>

</michael> elucidates:
> Please look at this script.  It should find every sub directory
> recursively but stops for some reason.  Id anyone could figure this
> out I would greatly appreciate it.  

There is already a very nice round wheel already carved for finding things
recursively on your file system.  Check out the documentation for 
File::Find, and be enlightened.

Good Luck!



-- 
"Civilization rests on two things: the discovery that fermentation 
produces alcohol, and the voluntary ability to inhibit defecation.  
And I put it to you, where would this splendid civilization be without 
both?" --Robertson Davies "The Rebel Angels" 


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

Date: 18 Oct 2000 18:20:32 +0100
From: nobull@mail.com
Subject: Re: Perl not functioning in practice as it should in theory.  - test.pl (0/1)
Message-Id: <u94s2axdzz.fsf@wcl-l.bham.ac.uk>

</michael> writes:

> Please look at this script.  It should find every sub directory
> recursively but stops for some reason.

Why are you re-inventing File::Find?

> Id anyone could figure this out I would greatly appreciate it.

It is poor form to post code here that doesn't "use strict" because it
wastes our time getting us to do something you could have made Perl do
for you.  The same applies to enabling warnings and testing the return
values from system calls.

Forgetting to my() your variables will cause trouble for you sooner or
later.  In the case of recursive programs it is thankfully sooner
rather than later.

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


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

Date: Wed, 18 Oct 2000 13:05:29 -0400
From: </michael>
Subject: Perl not functioning in practice as it should in theory.  - test.pl (1/1)
Message-Id: <p2mrus0pr80qr3lls6r0m1v8t515vqbfsl@4ax.com>


begin 644 test.pl
M(R$O=7-R+V)I;B]P97)L"@I`9&ER96-T;W)Y(#T@*"<O:&]M92]U<V5R<R]M
M:6-H865L)RD["@IS=6(@;W!E;D1I<B!["@H@("!M>2`H)$EM86=E1&ER*2`]
M($!?.PH*("`@;W!E;F1I<BA,4RPD26UA9V5$:7(I.PH@("`@("!`9FEL92`]
M(')E861D:7(H3%,I.PH@("!C;&]S961I<BA,4RD["@H@("!F;W)E86-H("1F
M:6QE("A`9FEL92D@>PH@("`@("!I9B`H*"UD("1F:6QE*28F*"$H)&9I;&4@
M/7X@+UPN+RDI*2!["B`@("`@("`@('!U<V@H0&1I<F5C=&]R>2PB)$EM86=E
M1&ER+R1F:6QE(BD["B`@("`@("`@('!R:6YT("(@("!!9&1I;F<Z("1);6%G
M941I<B\D9FEL95QN(CL*("`@("`@?0H@("!]"GT*"G=H:6QE("A`9&ER96-T
M;W)Y*2!["B`@('!R:6YT(")396%R8VAI;F<Z("1D:7)E8W1O<GE;,%U<;B([
M"B`@(&]P96Y$:7(H)&1I<F5C=&]R>5LP72D["B`@('-H:69T*$!D:7)E8W1O
'<GDI.PI]"FY$
`
end


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

Date: 18 Oct 2000 12:26:22 -0400
From: herveus@Radix.Net (Michael Houghton)
Subject: Re: perl objects and methods
Message-Id: <8skive$gf8$1@saltmine.radix.net>

Howdy!

In article <%POG5.1785$gu5.481490@news.uswest.net>,
Jerome O'Neil <jerome.oneil@360.com> wrote:
>"Godzilla!" <godzilla@stomp.stomp.tokyo> elucidates:
>
>> 
>> I can write troll articles infinitely better than
>> yours with my entire brain tied behind my back.
>
>It's pretty well established that your brain is located immediately
>below your back, not behind it.
>
"brain"? You keep using this word. I do not think it means what you
think it means.

yours,
Michael


-- 
Michael and MJ Houghton   | Herveus d'Ormonde and Megan O'Donnelly
herveus@radix.net         | White Wolf and the Phoenix
Bowie, MD, USA            | Tablet and Inkle bands, and other stuff
                          | http://www.radix.net/~herveus/


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

Date: Wed, 18 Oct 2000 11:16:50 -0400
From: "John MacLeod" <john@macleodweb.com>
Subject: Perl question - Backup and email a file?
Message-Id: <8skeld02akh@enews4.newsguy.com>

I can't figure out how to do this using a Perl script. Could someone please
help me out?

I need to...

1. Backup a txt file (formresults.txt).
2. Email the formresults.txt file to an external email address
(client@hisdomain.com)

The file is located at...
/usr/www/users/myaccount/client/formresults.txt

Once I have the script figured out I want to set up a cron job to backup the
file and email once a day.

Thanks in advance,
John MacLeod
john@macleodweb.com




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

Date: Wed, 18 Oct 2000 18:27:55 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: Perl question - Backup and email a file?
Message-Id: <%ckH5.7313$Tq1.232283@news010.worldonline.dk>

John MacLeod wrote:

> I can't figure out how to do this using a Perl script. Could someone
> please help me out?
> 
> I need to...
> 
> 1. Backup a txt file (formresults.txt).
> 2. Email the formresults.txt file to an external email address
> (client@hisdomain.com)
> 
> The file is located at...
> /usr/www/users/myaccount/client/formresults.txt
> 
> Once I have the script figured out I want to set up a cron job to backup
> the file and email once a day.

looks like oyu need to start over with perldoc perl...

that said, perl may be a bit overkill! look at the cron and crontab 
manuals...

-anders

-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Wed, 18 Oct 2000 08:33:47 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Perl: Day One, a Stupid Question
Message-Id: <39EDC2DB.658F0AD2@vpservices.com>

frannyzoo@hotmail.com wrote:
> 
> In article <39ECB688.E2390702@vpservices.com>,
>   Jeff Zucker <jeff@vpservices.com> wrote:
> > frannyzoo@hotmail.com wrote:
> >
> > The answer is on page 17 of _The Way of the Pilgrim_
>
>..I mean hell, I don't even get the jokes yet.

Well, perhaps it was bit obscure. Your mailing nick is "frannyzoo";
there is a classic book called "Franny and Zoe"; one of the characters
in the book became obsessed with Russian mysticism from reading _The Way
of the Pilgrim_ (a 19th century reworking of the early Russian
mystics).  As for the number 17, it is the number sacred to the
programmer, see the hacker's dictionary.

> is there any way to slow perl scripts when they do run?

a. always open a DOS box and run them there rather than clicking on an
icon

b. Use: perl scriptname | more

And if you don't have more.com, you can get it from they cygwin website.

-- 
Jeff


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

Date: Wed, 18 Oct 2000 17:05:09 GMT
From: frannyzoo@hotmail.com
Subject: Re: Perl: Day One, a Stupid Question
Message-Id: <8skl7t$450$1@nnrp1.deja.com>

That's a good one...actually the nick is derived from the Salinger book,
although I'm old fashioned and prefer obscure references from "Catcher".
 ..but holden was taken, etc.  I'm guessing F&Z appeals to you from the
"college bowl" encyclopedic knowledge angle.  What did you think of
"Magnolia"?...anyway, thanks for the hints...I'm slogging onward,
anti-perl sentiments notwithstanding, although sometimes I'd rather just
do perl in a goddam closet...

scot


In article <39EDC2DB.658F0AD2@vpservices.com>,
  Jeff Zucker <jeff@vpservices.com> wrote:
> frannyzoo@hotmail.com wrote:
> >
> > In article <39ECB688.E2390702@vpservices.com>,
> >   Jeff Zucker <jeff@vpservices.com> wrote:
> > > frannyzoo@hotmail.com wrote:
> > >
> > > The answer is on page 17 of _The Way of the Pilgrim_
> >
> >..I mean hell, I don't even get the jokes yet.
>
> Well, perhaps it was bit obscure. Your mailing nick is "frannyzoo";
> there is a classic book called "Franny and Zoe"; one of the characters
> in the book became obsessed with Russian mysticism from reading _The
Way
> of the Pilgrim_ (a 19th century reworking of the early Russian
> mystics).  As for the number 17, it is the number sacred to the
> programmer, see the hacker's dictionary.
>
> > is there any way to slow perl scripts when they do run?
>
> a. always open a DOS box and run them there rather than clicking on an
> icon
>
> b. Use: perl scriptname | more
>
> And if you don't have more.com, you can get it from they cygwin
website.
>
> --
> Jeff
>


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


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

Date: Wed, 18 Oct 2000 08:43:57 -0700
From: Paul Spitalny <pauls_spam_no@pauls.seanet.com>
Subject: pointing to a particular line in a file - how do you do it?
Message-Id: <39EDC53C.53FA3728@pauls.seanet.com>

Hi,
How can I open a file, and point to the n'th line in that file. I tried
using "seek" but the effect of that function was to move the pointer to
within the current line of the inout file and NOT to a differernt line.

example: I open a file

open(FRED,'<fred.dat);
binmode(FRED);
while ($_=<FRED>)
    {
    move $_ to the n'th line of the file  <- how do I do this???
    read(FRED, $in, 8)
    print "$in\n"
    }
close(FRED);

--
To respond to this posting, remove -nospam- from my email address.
Sorry for the inconvenience




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

Date: 18 Oct 2000 11:54:55 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: pointing to a particular line in a file - how do you do it?
Message-Id: <m3hf6aks2o.fsf@dhcp11-177.support.tivoli.com>

Paul Spitalny <pauls_spam_no@pauls.seanet.com> writes:

> Hi,
> How can I open a file, and point to the n'th line in that file. I tried
> using "seek" but the effect of that function was to move the pointer to
> within the current line of the inout file and NOT to a differernt line.

Unfortunately, the nature of line-based files is that you do not know
how long each line is, so there is no shortcut for skipping to a
certain line -- you just have to read (and skip) all of the
intervening lines.

open FRED, "fred.dat" or die "Could not open fred.dat, $!";
<> for 1..$n-1;   # Skip $n-1 lines... assumes $n is already set
$in = <>;         # Get the $n-th line
close FRED;

> example: I open a file
> 
> open(FRED,'<fred.dat);
> binmode(FRED);
> while ($_=<FRED>)
>     {
>     move $_ to the n'th line of the file  <- how do I do this???
>     read(FRED, $in, 8)
>     print "$in\n"
>     }
> close(FRED);

This example makes it look like you are not actually processing lines,
but rather records.  In that case, you should be able to simply seek
to the correct position.

open FRED, "fred.dat" or die "Could not open fred.dat, $!";
binmode FRED;
seek FRED, $n * 8, 0;
read FRED, $in, 8;
close FRED;

HTH,
-- 
Ren Maddox
ren@tivoli.com


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

Date: Wed, 18 Oct 2000 17:36:10 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: pointing to a particular line in a file - how do you do it?
Message-Id: <eclH5.49$123.22589@news.pacbell.net>

Paul Spitalny <pauls_spam_no@pauls.seanet.com> wrote:
> Hi,
> How can I open a file, and point to the n'th line in that file. I tried
> using "seek" but the effect of that function was to move the pointer to
> within the current line of the inout file and NOT to a differernt line.

> example: I open a file

> open(FRED,'<fred.dat);

Hmm. didn't check open status.

> binmode(FRED);
> while ($_=<FRED>)
>     {
>     move $_ to the n'th line of the file  <- how do I do this???
>     read(FRED, $in, 8)
>     print "$in\n"
>     }

I don't understand this at all.  You've got the reading done in a while
loop that implies that you want to read through the file, but you want
to move the n'th line.  What happens the next time through the loop?  Do
you want to move back to the n'th line, or move forward another n lines?

Here's a suggestion.

# skip forward 40 lines.
foreach (1 .. 40) { <FRED>; }

I don't think you want a while at all, but that's just a guess.

-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
      < Please move on, ...nothing to see here,  please disperse >


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

Date: Wed, 18 Oct 2000 17:48:16 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: pointing to a particular line in a file - how do you do it?
Message-Id: <8sknrj$r7b$1@news.mch.sbs.de>

In article <39EDC53C.53FA3728@pauls.seanet.com>, pauls@pauls.-nospam-seanet.com wrote:
>Hi,
>How can I open a file, and point to the n'th line in that file. I tried
>using "seek" but the effect of that function was to move the pointer to
>within the current line of the inout file and NOT to a differernt line.
[snip]

Two things you might be interested in knowing :

1) $. contains the current input line number, so you could
use that to check if you're on the right line in your while()
loop.

while (<FRED>) {
        if ($. == 12) { # this is the line you're interested in
                $in = substr($_,0,8); # get the first 8 characters
                print "$in\n"; # do something with that
                last; # let's get out of this loop, we've seen enough
        }
}

2) perlfaq5 has some interesting things to say about trying
to use Perl as a text editor. :)

"How do I change one line in a file/delete a line in a
file/insert a line in the middle of a file/append to the
beginning of a file?"

HTH,


Michel.


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

Date: 18 Oct 2000 19:58:57 +0200
From: Julien Quint <julien.quint@xrce.xerox.com>
Subject: Problem with locale and \s
Message-Id: <th3dhuowta.fsf@lautaret.grenoble.xrce.xerox.com>

Hi all,

I encountered a problem with the locale pragma. I needed to sort text in
French in alphabetical order, so I used the locale pragma and sorting works
just fine. However, I have a small function that pretty-prints my text which
suffers from locale. I discovered that the character of code 0xa0, i.e. non-
breaking space, was matched by \s which broke my formatting function.

For instance: in French, a colon must be preceded by a non-breaking space.
"Par exemple : en franc,ais..." (I typed a regular space so that my post
remains in the ASCII domain). We use a non-breaking space so that we don't
end up with something like

	       ... Par exemple
	: en francais ...

but since perl considers the non-breaking space character to be a normal
space character, this is what I end up with anyway. Grrr...

I quickly solved the problem by having my 'use locale;' line *after* having
declared the formatting function (and *before* the code that needs it) but
this is not satisfying. Should this be viewed as a bug? I'd like to hear
your opinion.

-- 
Julien

               perl -wlMstrict -e 'sub another::AUTOLOAD{shift;@_,split/::/,
  $another::AUTOLOAD}*hacker::AUTOLOAD=*hacker::AUTOLOAD=*another::AUTOLOAD;
                         $,=chr 0xa0;print reverse Just another Perl hacker'


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

Date: Wed, 18 Oct 2000 11:31:17 -0500
From: "Jack Barnett" <jbarnett@axil.netmate.com>
Subject: Program design
Message-Id: <surk506o3iti03@corp.supernews.com>


Hi,

I have been programming in perl for a couple years (self taught) and haven't
had any real programming corses in school.  I can do most things, but I am
now coding a huge cgi program in perl and it is getting real messy.

I decided to use an oo style with this program, but it is getting really
messy really quick and I am not even 1/10 way though, and maintaining it or
updating it is going to suck major.  It is basically a cgi script that has
user account and access to a database,  I do see that it will work, but it
isn't going to be clean or pretty.

Is there any way to force perl to force the user to use correct oop "rules"?
So perl behaves more like java and throws an error when you access another
classes private data, etc?

Also is there any documents on program design in perl (or program design in
general, the only sytnax I know is perl and java, so something using small
talk or lisp as an example might confuse me on the syntax level).

How do you go from "knowing the syntax" to a real perl programmer that knows
how to correctly design a program from the ground up before any code is even
laid down?

The design and pre-planning is really screwing me up. I always have to do a
complete re-write of the program 4-5 times before I can get something
"good-enough for now". Any advice or suggestions?

Thanks,
Jack










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

Date: Wed, 18 Oct 2000 19:59:22 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: Program design
Message-Id: <KylH5.7363$Tq1.235332@news010.worldonline.dk>

Jack Barnett wrote:

> 
> Hi,
> 
> I have been programming in perl for a couple years (self taught) and
> haven't
> had any real programming corses in school.  I can do most things, but I am
> now coding a huge cgi program in perl and it is getting real messy.
> 
> I decided to use an oo style with this program, but it is getting really
> messy really quick and I am not even 1/10 way though, and maintaining it
> or
> updating it is going to suck major.  It is basically a cgi script that has
> user account and access to a database,  I do see that it will work, but it
> isn't going to be clean or pretty.
> 
> Is there any way to force perl to force the user to use correct oop
> "rules"? So perl behaves more like java and throws an error when you
> access another classes private data, etc?

You should spend some money on books, visit http://perl.oreilly.com or 
http://www.amazon.com and look around for some


> Also is there any documents on program design in perl (or program design
> in general, the only sytnax I know is perl and java, so something using
> small talk or lisp as an example might confuse me on the syntax level).

http://www.perl.com/CPAN-local/doc/manual/html/pod/perlstyle.html
or
$ perldoc perlstyle


> How do you go from "knowing the syntax" to a real perl programmer that
> knows how to correctly design a program from the ground up before any code
> is even laid down?

parctice, reading, practice, practice...

> The design and pre-planning is really screwing me up. I always have to do
> a complete re-write of the program 4-5 times before I can get something
> "good-enough for now". Any advice or suggestions?

If you know what your application has do, you have to decide which logical 
objects you need, and what functionality each should provide to do their 
job.


Read the code for some of the standard modules, they are well coded.

-anders

-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: 18 Oct 2000 16:05:44 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Regex substitution question...
Message-Id: <8skhoo$3v3$1@lublin.zrz.tu-berlin.de>

Bart Lateur  <bart.lateur@skynet.be> wrote in comp.lang.perl.misc:
>Colin Tucker wrote:
>
>>[Display("[Value("foobar")]")]
>
>>At the moment, I have it scanning for occurrences of square brackets with
>>anything between them, which it then evaluates as a function, and
>>substitutes the function's return value into the HTML, but the problem is
>>illustrated above - I want to be able to substitute "nested" commands.
>
>I think that is what the module Text::Balanced is for. It's part of the
>package for Parse::RecDescent.
>
>	use Text::Balanced 'extract_bracketed';
>	$text = <<'##';
>[Display("[Value("foobar")]")]
>...
></html>
>##
>	my($extracted, $remainder) = extract_bracketed($text,'[');
>	print "Extracted: '$extracted'\n";
>	print "Remainder: '$remainder'\n";
>-->
>Extracted: '[Display("[Value("foobar")]")]'
>Remainder: '
>...

Yes, but that's only half the story.  If I understand the OP correctly,
after having found a (nested) construct of [], he will want to evaluate
the inner functions, substitute the results into an outer one, evaluate
that, and so on.  In other words, he's writing an interpreter for a
functional programming language, or at least a macro processor.  I
suspect he'll need the full Parse::RecDescent for that.  With that,
an interpreter for nested function calls (for pre-defined functions)
shouldn't be hard to write.

Anno


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

Date: Wed, 18 Oct 2000 16:47:41 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Rijndael in Perl
Message-Id: <1eipo5k.cqrn9u17tsqe1N%tony@svanstrom.com>

Anyone that knows if Rijndael exists in Perl yet and/or if someone's
working on it?


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
   on the verge of frenzy - i think my mask of sanity is about to slip
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©99-00 <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: Wed, 18 Oct 2000 11:04:55 -0400
From: DesQuite <desquite@hotmail.com>
Subject: Re: Search, pad, replace
Message-Id: <39EDBC16.DDA3E098@hotmail.com>

Let me clarify my specs since this since you've made this bigger deal than I
thought.

- I already have my variables in a hash
- I would like to search for the variable first to find it's position before
replacing it since there could be multiple ( and ) all over my data
- Between the ( ) only a single variable name can exist, and all the other
space could be any character.
- The variable name will always be left justified
- The value will never need to truncated b/c the value should never be longer
than the space provided between ( and )
- The opening and closing parentheses could appear anywhere b/c it's a
variable holding all of my data that I'm searching
- There will never be nested parentheses


> This sort of question comes up regularly on this group, although I've never
> seen one that included those brackets, and the requirement to keep the
> spacing constant. That's the only reason I worked on it, instea dof
> referring you to www.deja.com.

About deja.com.  I've been looking there even before this post but it's hard
to narrow my searches down.

> And even then I was tempted to sit on it for a day. The main reason for that
> is that you mention that you're in a hurry. My reasoning is that if you're
> in a hurry, then you should pay someone to do it for you. If you have a
> deadline, that means someone else is paying you for this. You obviously
> can;t do it, so you should pay someone else.

This is a solution that will help us and needs to be done soon.  This program
is also the only program we have that uses Perl.  We don't need extra help and
we're not willing to pay someone else.

Thanks.  You're an asshole.



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

Date: Wed, 18 Oct 2000 11:45:58 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Search, pad, replace
Message-Id: <Pine.GSO.4.21.0010181144051.25707-100000@crusoe.crusoe.net>

[posted & mailed]

On Oct 18, DesQuite said:

>Let me clarify my specs since this since you've made this bigger deal than I
>thought.
>
>- I already have my variables in a hash
>- I would like to search for the variable first to find it's position before
>replacing it since there could be multiple ( and ) all over my data
>- Between the ( ) only a single variable name can exist, and all the other
>space could be any character.
>- The variable name will always be left justified
>- The value will never need to truncated b/c the value should never be longer
>than the space provided between ( and )
>- The opening and closing parentheses could appear anywhere b/c it's a
>variable holding all of my data that I'm searching
>- There will never be nested parentheses
>
>Thanks.  You're an asshole.

Um, he gave you a solution that fit what he interpreted your specs were,
and told he ordinarily wouldn't have done this, and spent HIS time working
on something for YOU, and HE'S an asshole?  You sound pretty ungrateful to
me.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/





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

Date: Wed, 18 Oct 2000 13:17:34 -0400
From: DesQuite <desquite@hotmail.com>
Subject: Re: Search, pad, replace
Message-Id: <39EDDB2E.71EB27AD@hotmail.com>

I'm grateful for his time and ungrateful for his tone.  He doesn't know my
situation and if he didn't want to post he didn't have to.

Jeff Pinyan wrote:

> Um, he gave you a solution that fit what he interpreted your specs were,
> and told he ordinarily wouldn't have done this, and spent HIS time working
> on something for YOU, and HE'S an asshole?  You sound pretty ungrateful to
> me.
>
> --
> Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
> PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
> The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
> CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/



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

Date: Wed, 18 Oct 2000 10:37:34 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Sort Help Needed
Message-Id: <39EDC3BE.DF9E2BF1@rac.ray.com>

"Godzilla!" wrote:
> 
> I have modified your input data into a
> format which is usable and easy with
> which to work, as you should have done.
> 

You can't modify input data, input data just IS. You have to work with
it in whatever form it's provided to you.
-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

Quae narravi, nullo modo negabo. - Catullus


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

Date: Wed, 18 Oct 2000 10:26:56 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Sort Help Needed
Message-Id: <39EDDD5F.57AFC5AF@stomp.stomp.tokyo>

Russ Jones wrote:
 
> "Godzilla!" wrote:

> > I have modified your input data into a
> > format which is usable and easy with
> > which to work, as you should have done.
> >
 
> You can't modify input data, input data just IS. You 
> have to work with it in whatever form it's provided to you.


$his_comments =~ s/can't/can/;

I just modified your input data. Now what
are you going to do, Bozo?

Jeessshhh... some people are so toopid.

Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


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

Date: Wed, 18 Oct 2000 10:20:16 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Sort Help Needed
Message-Id: <MPG.14577badf605027298ae44@nntp.hpl.hp.com>

In article <39ED552B.4A01D107@stomp.stomp.tokyo> on Wed, 18 Oct 2000 
00:45:47 -0700, Godzilla! <godzilla@stomp.stomp.tokyo> says...
> 
> $input = "warrenh    ¦10202000 warren    hal
>           udontquit  ¦10112000 todd      gar
>           tim.glaze  ¦10172000 tim       gla
>           teamesteem ¦10252000 andy      bee
>           ellenm     ¦10162000 ellen     mur
>           stetson    ¦10152000 jeffry    ste
>           scoping    ¦10302000 judy      bar
>           customcoat ¦10012000 carl      pen
>           crusaderra ¦10182000 j.e.      mac";
> 
> @Array = split (/\n/, $input);
> 
> @New_Array = map { $_ -> [0] } sort { $a -> [1] <=> $b -> [1] }
>              map { [$_, (split /¦/) [1]] } @Array;

That is not a proper date sort, as one would discover in a few months.

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


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

Date: Wed, 18 Oct 2000 17:36:58 +0100
From: "JA" <jalford12@yahoo.co.uk>
Subject: Re: split on comma except when embedded inside quotes
Message-Id: <mnkH5.35295$Kx.2640107@e420r-sjo1.usenetserver.com>

>I was shocked! How could JA <jalford12@yahoo.co.uk>
>say such a terrible thing:
>>I'm sure I've seen this somewhere but I can't find it.
>>
>>I've got a CSV file that contains comma delimited data that includes
quoted
>>strings with an embedded comma.
>>
>>for example:-
>>
>>8 Alexandra Road,"Wimbledon, London",SW19 7JZ,020 8273 5057
>>
>>I need to be able to split the line on the comma, ignoring any quote
embedded
>>commas.
>
>This is in the faq:
>
>perldoc -q 'How can I split a [character] delimited string except when'
>
>Hope that helps

No documentation for perl FAQ keyword 'How' found







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

Date: Wed, 18 Oct 2000 17:37:36 +0100
From: "JA" <jalford12@yahoo.co.uk>
Subject: Re: split on comma except when embedded inside quotes
Message-Id: <YnkH5.35302$Kx.2640668@e420r-sjo1.usenetserver.com>


OK, thanks folks.

I finally got it to work using the Text::ParseWords do-hickey...I learned a LOT
about how Perl works its 'library' in the process :-)

[initially sabotaged of course, by script stripping " from line before it ever
got to the split bit...]

J.







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

Date: Wed, 18 Oct 2000 17:41:25 +0100
From: "Géry" <ducateg@info.bt.co.uk>
Subject: tie?
Message-Id: <8skjsk$8hh$1@pheidippides.axion.bt.co.uk>

Hi,

This is a newbie ?

I am using tie on a variable that stores a hash in a hash. I populate the
variable fine in one script but if I want to read this variable again from
the file from another script it just gives me the first key, the hash is
empty :(

so to summarise it looks like this

tie %my_hash, db_module, "somefile.txt";

some code to populate the hash

untie %my_hash

Is there something else I should do to save what is actually the data in
this hash to be able to retrieve it from another script?

many thanks in advance,

--
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Géry Ducatel
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<




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

Date: Wed, 18 Oct 2000 17:39:57 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: weird print behaviorr
Message-Id: <39EDC44D.D9B8C995@schaffhausen.de>

Dies ist eine mehrteilige Nachricht im MIME-Format.
--------------DBECCB375A28291C60B97896
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,


I just discovered a really weird behavior of Perl's print.
Well, at least I think its weird, cuz I have been programming
in Perl for 5 years now and I never encountered anything like it.

I have a statement like this:

print "someString ", CLASS->lookupSomethingInTheDatabase(), " aString";

The output one would expect would be:
someString someData aString

But this happens:
someData someString aString

Perl somehow seems to shift around the order of the list
which is passed to print. The behavior is consistent but as
soon as you split up the print into 3 separate statements
everything behaves as expected again.

Does anybody know why this happens? Maybe it's got something
to do with buffering. I'm using Perl 5.6 with mySQL on SUSE

Thanx,

malte
--------------DBECCB375A28291C60B97896
Content-Type: text/x-vcard; charset=us-ascii;
 name="ubl.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Visitenkarte fŸr Malte Ubl
Content-Disposition: attachment;
 filename="ubl.vcf"

begin:vcard 
n:Ubl;Malte
tel;cell:+49 173 9237521
tel;fax:+49 4121 472938
tel;home:+49 4121 438297
tel;work:+49 4121 472964
x-mozilla-html:FALSE
url:http://www.schaffhausen.de
org:Schaffhausen | Interactive
adr:;;Daimlerstrasse 17;Elmshorn;;25337;Germany
version:2.1
email;internet:ubl@schaffhausen.de
title:Developer for web-based applications
x-mozilla-cpt:;1
fn:Malte Ubl
end:vcard

--------------DBECCB375A28291C60B97896--



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

Date: 18 Oct 2000 17:51:37 +0100
From: nobull@mail.com
Subject: Re: weird print behaviorr
Message-Id: <u97l76xfc6.fsf@wcl-l.bham.ac.uk>

Malte Ubl <ubl@schaffhausen.de> writes:

> print "someString ", CLASS->lookupSomethingInTheDatabase(), " aString";
> 
> The output one would expect would be:
> someString someData aString
> 
> But this happens:
> someData someString aString

I expect CLASS->lookupSomethingInTheDatabase is print()ing someData
rather than return()ing it.

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


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

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


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