[22533] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4754 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 24 14:06:02 2003

Date: Mon, 24 Mar 2003 11:05:08 -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           Mon, 24 Mar 2003     Volume: 10 Number: 4754

Today's topics:
    Re: "globbing" command line args on W2K? <ericm-NO-SPANM@vertical.com>
    Re: Change a variable (David Combs)
    Re: Change a variable (Helgi Briem)
    Re: currency number to text conversion <mbudash@sonic.net>
    Re: currency number to text conversion <mbudash@sonic.net>
    Re: Deep Recursion problem in Win32 clipboard.pm (Phil Hibbs)
    Re: having PERL respond to a key press (David Combs)
    Re: having PERL respond to a key press (David Combs)
    Re: How to use Net::FTP - FTP Client class through a Fi (Sam Holden)
        Newbie needs help: Checking input after blank line (Bex)
    Re: Newbie needs help: Checking input after blank line <mbudash@sonic.net>
    Re: Newbie needs help: Checking input after blank line <thepoet@nexgo.de>
    Re: Newbie needs help: Checking input after blank line <mbudash@sonic.net>
    Re: Perl ODBC and SQL <tore@aursand.no>
    Re: Perl ODBC and SQL <mbudash@sonic.net>
    Re: perl's expat.so <ndronen@io.frii.com>
        pointing stderr to a module (Scott)
    Re: pointing stderr to a module <pilsl_usenet@goldfisch.at>
    Re: Problem using CGI.pm and SSL. <shah@typhoon.xnet.com>
    Re: Problem with Getopt::Std and getopts().... <jurgenex@hotmail.com>
    Re: Really weird?!? <ndronen@io.frii.com>
    Re: Really weird?!? <mbudash@sonic.net>
    Re: update value in flat file (Anno Siegel)
    Re: update value in flat file <noreply@gunnar.cc>
    Re: update value in flat file <jurgenex@hotmail.com>
        why heredoc? was: Re: print here-documents question <mpapec@yahoo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 24 Mar 2003 17:35:12 GMT
From: Eric McDaniel <ericm-NO-SPANM@vertical.com>
Subject: Re: "globbing" command line args on W2K?
Message-Id: <Xns9348619EE7F33ooheehoohahah@207.225.159.7>

Edwin Guenthner <edgue@web.de> wrote in news:3E7F0DB9.4090206@web.de:

> I would like to start perl and to run with several
> scripts, like
> 
> perl -MmyStuff xy*.pl
> 
> That would work on Unix; but not on Windows or OS/2:
> 
> Can't open perl script "xy*.pl": Invalid argument


This will work in Windows. Not sure about OS/2:

for %x in (xy*.pl) do perl -Mmystuff %x



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

Date: Mon, 24 Mar 2003 16:06:04 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: Change a variable
Message-Id: <b5nadc$8u8$1@reader2.panix.com>

In article <b3dpcg$jan$1@nets3.rz.RWTH-Aachen.DE>,
Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote:
>...
>You don't have a clue, do you? Jürgen did not complain about the
>question but rather about the fact that you multiposted the question to
>several groups. I suggest you use a search engine to find out about the
>difference of multipost and crosspost.

More helpful, and certainly nicer, perhaps, would have 
been to simply *explain* the difference between the two.

Not only would it save the OP the three or four minutes
to do the search and find an acceptable link, but 
explaining it right here would have let *everyone else*
learn too -- to the eventual great relief that would
be provided to you and all the other wonderfully-generous
responders to all these questions.

*Everyone* would benefit.

Anyway, that's *my* kneejerk response.

Cheers to all you great helpers!

David





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

Date: Mon, 24 Mar 2003 16:21:25 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Change a variable
Message-Id: <3e7f2fb3.3904346403@news.cis.dfn.de>

On Mon, 24 Mar 2003 16:06:04 +0000 (UTC), dkcombs@panix.com
(David Combs) wrote:

>In article <b3dpcg$jan$1@nets3.rz.RWTH-Aachen.DE>,
>Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote:
>>...
>>You don't have a clue, do you? Jürgen did not complain about the
>>question but rather about the fact that you multiposted the question to
>>several groups. I suggest you use a search engine to find out about the
>>difference of multipost and crosspost.
>
>More helpful, and certainly nicer, perhaps, would have 
>been to simply *explain* the difference between the two.

We (they) have explained this right here VERY, VERY often.
The posting guidelines are posted here EVERY month!

You can read them at
http://mail.augustmail.com/~tadmc/clpmisc.shtml

>Not only would it save the OP the three or four minutes
>to do the search and find an acceptable link, but 
>explaining it right here would have let *everyone else*
>learn too -- to the eventual great relief that would
>be provided to you and all the other wonderfully-generous
>responders to all these questions.
>
>*Everyone* would benefit.

Usenet has certain conventions and guidelines of
what is regarded as polite and what is not.

 For more information about netiquette in general, see the
"Netiquette Guidelines" at:
http://andrew2.andrew.cmu.edu/rfc/rfc1855.html

-- 
Regards, Helgi Briem
helgi DOT briem AT decode DOT is


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

Date: Mon, 24 Mar 2003 16:40:15 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: currency number to text conversion
Message-Id: <mbudash-52207B.08401624032003@typhoon.sonic.net>

In article <slrnb7tu11.471.tadmc@magna.augustmail.com>,
 tadmc@augustmail.com (Tad McClellan) wrote:

> Michael Budash <mbudash@sonic.net> wrote:
> > In article <3trfa.16086$pK4.1449944@newsread1.prod.itd.earthlink.net>,
> >  "Jodyman" <Jodyman@hotmail.com> wrote:
> >> "Mike" <earthtrip@gmx.net> wrote in message
> >> news:b5l7d9$2aedu1$1@ID-161707.news.dfncis.de...
> >> > Cameron wrote:
> 
> >> > > Has anyone run across a module that handles the conversion of currency
> >> > > amounts - number to text string and visa versa. For example $500.00 ->
> >> > > FIVE HUNDRED DOLLARS or FIVE HUNDRED DOLLARS -> $500.00.
> 
> > i've 
> > performed an initial conversion of the VB code to perl,
> 
> > but i'd respectfully like to ask you folks to 
> > critically review this V.01 code, looking for bugs, poor practices, etc.
> > 
> > sub NumToString {
> > 
> >    my $nNumber = shift;
> 
> 
> I'd add some argument checking here:
> 
>    warn "NumToString: called with more than one argument\n" if @_;
> 
> 
> >    my $NumToString;
> 
> 
> You don't use this until much later, so it should be declared
> much later (ie. right before its first use).

thanks, tad.

-- 
Michael Budash


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

Date: Mon, 24 Mar 2003 17:10:13 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: currency number to text conversion
Message-Id: <mbudash-750BC2.09101324032003@typhoon.sonic.net>

In article <rOzfa.64$3j5.38536@newsfep1-win.server.ntli.net>,
 Chris Lowth <please@no.spam> wrote:

> Michael Budash wrote:
> 
> > In article <3trfa.16086$pK4.1449944@newsread1.prod.itd.earthlink.net>,
> >  "Jodyman" <Jodyman@hotmail.com> wrote:
> > 
> >  .. etc ..
> 
> Is all the world American? What about some internationalisation?

excellent idea - have at it!

-- 
Michael Budash


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

Date: 24 Mar 2003 09:45:53 -0800
From: gg@snark.freeserve.co.uk (Phil Hibbs)
Subject: Re: Deep Recursion problem in Win32 clipboard.pm
Message-Id: <a9ec249e.0303240945.15fba579@posting.google.com>

anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message news:<b5mvlp$4m4$3@mamenchi.zrz.TU-Berlin.DE>...
> Where is constant() defined?

Um, it isn't.

> If it isn't, you're calling an undefined function from AUTOLOAD, 
> which calls AUTOLOAD again... .  A recipe for deep recursion.

Fair point. I wonder why there is no constant() function. Must be a
bad installation. Unfortunately I can't fix it, and I don't think
anyone else uses Perl, so I'm a bit screwed. "The Rules" forbid me
from installing software. Arse.

Phil Hibbs.


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

Date: Mon, 24 Mar 2003 15:07:25 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: having PERL respond to a key press
Message-Id: <b5n6vd$7ob$1@reader2.panix.com>

In article <slrnb5g1sq.2fm.mgjv@martien.heliotrope.home>,
Martien Verbruggen  <mgjv@tradingpost.com.au> wrote:
>[You have been asked, by several people, several times, to stop
>top-posting, yet you persist. You obviously are doing it on purpose. 
>
>You have been asked for more information about error messages, yet you
>simply ignore this.
>
>I can only conclude that you are here to deliberately annoy us.
>
>I will therefore put you, after this post, in my killfile, as I am sure
>many others will as well.]
>
<SNIP>
>
>*PLONK*
>
>Martien
>-- 
>                        | 
>Martien Verbruggen      | 


Killfiling somone is pretty rough, Martien.

Some people (myself unfortunately included) post to
a whole bunch of groups, and (myself unfortunately included)
lose track of where we must soon get back to.

For me, a solution would be (for someone) to hack
Pnews, a shell-script front-end to a news-posting
program ("engine"?) -- it leves no record of what
it's posted and what it's posted to.

It would be an *enormous* help to us OPs, as well
lowering the blood pressure of you guys, you wonderful
question answers who donate *so much* time to us,
for someone (you?) to do quick hack to Pnews
to make it take a few args (or read a few extra
env-vars) and according to thise, perhaps:

 . Append the entire posted msg to some one file.

 . Append the entire posted msg to a for-this-newsgroup-only
file -- eg onto Comp.land.perl.misc.POSTS

It would be an *enormous* help to us OPs, as well
lowering the blood pressure of you guys, you wonderful
question answers who donate *so much* time to us,
for someone (you?) to do quick hack to Pnews
to make it take a few args (or read a few extra
env-vars) and according to thise, perhaps:

 . Append the entire posted msg to some one file.

 . Append the entire posted msg to a for-this-newsgroup-only
file -- eg onto Comp.land.perl.misc.POSTS

 . Append just the subject,, date, and newsgroup.

etc.

In fact, if you make that strictly enough formatted,
then we can filter that file into whatever appointment-
notifying software that we use, so that we'll
get automatic notifications, on or after some particular
date/time, to go look at responses to our posts, and
respond to them.

Martien -- you're so good at perl that you're surely
fully capable with the Bourne shell.  Say so, and
I'll either email and/or post that script.

(Why do I use Pnews and not some other software?
Because I access the internet via a "shell account"
isp, and not only that what they provide for posts,
but the newsreader I use, trn, also uses it when
I reply to a post.)



--

David




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

Date: Mon, 24 Mar 2003 15:14:48 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: having PERL respond to a key press
Message-Id: <b5n7d8$7ob$2@reader2.panix.com>

In article <b5n6vd$7ob$1@reader2.panix.com>,
David Combs <dkcombs@panix.com> wrote:
<SNIP>

>Pnews, a shell-script front-end to a news-posting
>program ("engine"?) -- it leves no record of what
>it's posted and what it's posted to.
>
 ...
>for someone (you?) to do quick hack to Pnews
>to make it take a few args (or read a few extra
>env-vars) and according to thise, perhaps:
>
>. Append the entire posted msg to some one file.
>
>. Append the entire posted msg to a for-this-newsgroup-only
>file -- eg onto Comp.land.perl.misc.POSTS


It's also be nice to be able to force filling
the "CC" (better, "BC"?) -- it is possible to
type it in by hand, but it's *so* easy, especially
when tired, to not even notice the possibility.

If you (or someone) does do the hacks, I'll then
get the new version back to the people who (a)
maintain it and (b) include it (eg trn maintainers).

David

PS: again, some just ask, via either email and/or followup,
and I'll post the Pnews (bourne) script.




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

Date: 24 Mar 2003 14:28:58 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: How to use Net::FTP - FTP Client class through a Firewall
Message-Id: <slrnb7u5ha.nhc.sholden@flexal.cs.usyd.edu.au>

On 24 Mar 2003 06:01:08 -0800, Joe Kamenar <joey19020@aol.com> wrote:
> In order to get to the outside world, all traffic goes thtough a
> firewall. If I use wsftp, I can specify the firewall info in the
> set-up and everything works fine.
> 
> So, can this still be done with the FTP client in Perl?

Yes.

Read the documentation for the pretty obviously named constructor
argument.

-- 
Sam Holden



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

Date: 24 Mar 2003 08:43:14 -0800
From: be_insane@yahoo.com (Bex)
Subject: Newbie needs help: Checking input after blank line
Message-Id: <ffeea5b9.0303240843.418bf07e@posting.google.com>

Hi People, 

I'm new to perl and need some help...

I'm using a file to read in from and using pattern matching to select
the sections that i want from it.

So far i have got the main bits i need but i have now run into a
problem..

The files are all the same format, lines of text followed by one empty
line then more text.

What i would like to do is specifcy that after the first blank line is
detected all text from that point onwards (whether another blank line
or not) is selected, and outputted.

I just cannot seem to get this to work!

ANY input or notes of pages to look at would be brilliant.

Thanks in advance..
Becca


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

Date: Mon, 24 Mar 2003 17:55:35 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Newbie needs help: Checking input after blank line
Message-Id: <mbudash-B54B31.09553524032003@typhoon.sonic.net>

In article <ffeea5b9.0303240843.418bf07e@posting.google.com>,
 be_insane@yahoo.com (Bex) wrote:

> Hi People, 
> 
> I'm new to perl and need some help...
> 
> I'm using a file to read in from and using pattern matching to select
> the sections that i want from it.
> 
> So far i have got the main bits i need but i have now run into a
> problem..
> 
> The files are all the same format, lines of text followed by one empty
> line then more text.
> 
> What i would like to do is specifcy that after the first blank line is
> detected all text from that point onwards (whether another blank line
> or not) is selected, and outputted.
> 
> I just cannot seem to get this to work!
> 
> ANY input or notes of pages to look at would be brilliant.
> 
> Thanks in advance..
> Becca

at least two ways:

open (D, "thedata") or die ("Can't open thedata: $!");
my $D = do { local $/; <D>; };
close (D);
my $lastpart;

# 1)
$D =~ /^.+?\n\n(.+)$/s;
$lastpart = $1;

# 2)
$lastpart = (split(/\n\n/, $D, 2))[1];

hth-

-- 
Michael Budash


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

Date: Mon, 24 Mar 2003 19:28:29 +0100
From: "Christian Winter" <thepoet@nexgo.de>
Subject: Re: Newbie needs help: Checking input after blank line
Message-Id: <3e7f4e6f$0$9922$9b4e6d93@newsread2.arcor-online.net>

"Bex" <be_insane@yahoo.com> wrote:
[...]
> What i would like to do is specifcy that after the first blank line is
> detected all text from that point onwards (whether another blank line
[...]

Michaels solution slurps the whole text file
into memory. If it is big it may be better to
read and print line by line:
###################################
#!/path/to/perl -w

use strict;
my $hit=0;

open( I, "< $datafile" ) or die $!;
while(<I>) {
  print if( $hit );
  /^\n$/ && $hit++;
}
close I;
###################################

HTH
-Christian



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

Date: Mon, 24 Mar 2003 18:38:50 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Newbie needs help: Checking input after blank line
Message-Id: <mbudash-594959.10384924032003@typhoon.sonic.net>

In article <3e7f4e6f$0$9922$9b4e6d93@newsread2.arcor-online.net>,
 "Christian Winter" <thepoet@nexgo.de> wrote:

> "Bex" <be_insane@yahoo.com> wrote:
> [...]
> > What i would like to do is specifcy that after the first blank line is
> > detected all text from that point onwards (whether another blank line
> [...]
> 
> Michaels solution slurps the whole text file
> into memory. If it is big it may be better to
> read and print line by line:
> ###################################
> #!/path/to/perl -w
> 
> use strict;
> my $hit=0;
> 
> open( I, "< $datafile" ) or die $!;
> while(<I>) {
>   print if( $hit );
>   /^\n$/ && $hit++;
> }
> close I;
> ###################################
> 
> HTH
> -Christian
> 

good point. i'm not sure why, but i made the [possibly erroneous] 
assumption the the files would not be large enough to worry about.

-- 
Michael Budash


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

Date: Mon, 24 Mar 2003 15:41:16 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Perl ODBC and SQL
Message-Id: <pan.2003.03.24.13.28.56.798267@aursand.no>

On Sun, 23 Mar 2003 11:34:08 +0000, Bigus wrote:
> Using Win32::ODBC, [...]

You shouldn't;  Go for DBI instead, using the DBD::ODBC driver.  It's
easier to work with.

> $db->Sql("SELECT * FROM userstable WHERE user = '$nickname' ORDER BY
> thedate DESC");

Using DBI, you would be doing this instead;

  my $sth = $dbh->prepare('SELECT *
                           FROM userstable
                           WHERE user = ?
                           ORDER BY thedate DESC');
  $sth->execute( $nickname );
  # get your data here
  $sth->finish();

> Is there some sort of "escaping" I can do in Perl that might solve this,
> or any other remedy?

In my example above, the DBI module takes care of all that for you (as
long as you bind the parameter in via the execute() method).


-- 
Tore Aursand


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

Date: Mon, 24 Mar 2003 17:42:55 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Perl ODBC and SQL
Message-Id: <mbudash-6F7E17.09425524032003@typhoon.sonic.net>

In article <pan.2003.03.24.13.28.56.798267@aursand.no>,
 "Tore Aursand" <tore@aursand.no> wrote:

> On Sun, 23 Mar 2003 11:34:08 +0000, Bigus wrote:
> > Using Win32::ODBC, [...]
> 
> You shouldn't;  Go for DBI instead, using the DBD::ODBC driver.  It's
> easier to work with.
> 
> > $db->Sql("SELECT * FROM userstable WHERE user = '$nickname' ORDER BY
> > thedate DESC");
> 
> Using DBI, you would be doing this instead;
> 
>   my $sth = $dbh->prepare('SELECT *
>                            FROM userstable
>                            WHERE user = ?
>                            ORDER BY thedate DESC');
>   $sth->execute( $nickname );
>   # get your data here
>   $sth->finish();
> 
> > Is there some sort of "escaping" I can do in Perl that might solve this,
> > or any other remedy?
> 
> In my example above, the DBI module takes care of all that for you (as
> long as you bind the parameter in via the execute() method).

or he can explicitly ask the DBI module to take care of it on a 
case-by-case basis:

   my $sth = $dbh->prepare('SELECT *
                            FROM userstable
                            WHERE user = ' . $dbh->quote($nickname) . ' 
                            ORDER BY thedate DESC');

but placeholders do indeed rock, so your way is better in most cases...

-- 
Michael Budash


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

Date: 24 Mar 2003 15:41:26 GMT
From: Nicholas Dronen <ndronen@io.frii.com>
Subject: Re: perl's expat.so
Message-Id: <3e7f2726$0$191$75868355@news.frii.net>

Xiaojun Ping <xiaojun@netscape.com> wrote:

XP> There is no errors when I set LD_LIBRARY_PATH for libexpat.so before I 
XP> run my perl program, but I always get the following errors when I set 
XP> $ENV{LD_LIBRARY_PATH} to the same value inside my perl program, any idea ?

XP> ...perl5.6.0/sun4-solaris-thread-multi/auto/XML/Parser/Expat/Expat.so' 
XP> for module XML::Parser::Expat: ld.so.1: /usr/bin/perl: fatal: 
XP> libexpat.so.0: open failed: No such file or directory at 
XP> ...perl-5.6.0/SunOS5.6/lib/5.6.0/sun4-solaris-thread-multi/DynaLoader.pm 
XP> line 200, <F> line 5.

Perhaps you mean to do:

BEGIN {
	$ENV{LD_LIBRARY_PATH} = "/path/to/expat/lib:" . $ENV{LD_LIBRARY_PATH};
}

Regards,

Nicholas

-- 
"Why shouldn't I top-post?"    http://www.aglami.com/tpfaq.html
"Meanings are another story."  http://www.ifas.org/wa/glossolalia.html


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

Date: 24 Mar 2003 08:40:27 -0800
From: scott@scottsavarese.com (Scott)
Subject: pointing stderr to a module
Message-Id: <8747e98f.0303240840.5f969fc7@posting.google.com>

I have a module for an application I am working on that logs messages
to a file.

Pretty much a do a $mod = new LogModule( "file" ); $mod->do_log(
"message" ); and it will log "message" to the file.

The thing is, we get stderr messages that I also want to get logged. I
can do an open( STDERR, "file" ); but if I do that the stderr messages
come out unformatted without a time stamp...

So, I am wondering if I can redirect STDERR to the LogModule's do_log
function?

Thanks,
Scott


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

Date: Mon, 24 Mar 2003 18:33:26 +0100
From: peter pilsl <pilsl_usenet@goldfisch.at>
Subject: Re: pointing stderr to a module
Message-Id: <3e7f4178$5@e-post.inode.at>

Scott wrote:

> I have a module for an application I am working on that logs messages
> to a file.
> 
> Pretty much a do a $mod = new LogModule( "file" ); $mod->do_log(
> "message" ); and it will log "message" to the file.
> 
> The thing is, we get stderr messages that I also want to get logged. I
> can do an open( STDERR, "file" ); but if I do that the stderr messages
> come out unformatted without a time stamp...
>

just an idea:
you could pipe STDERR to a small perlscript that logs to your Module.

peter
 

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



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

Date: Mon, 24 Mar 2003 16:15:10 +0000 (UTC)
From: Hemant Shah <shah@typhoon.xnet.com>
Subject: Re: Problem using CGI.pm and SSL.
Message-Id: <b5naue$bi1$1@flood.xnet.com>

While stranded on information super highway Sharon Grant wrote:
:)On Fri, 21 Mar 2003 15:42:41 +0000 (UTC), in comp.lang.perl.misc, Hemant Shah <shah@typhoon.xnet.com> wrote:
:)
:)>While stranded on information super highway Hemant Shah wrote:
:)>
:)>If I use http://www.mysite.com/tst.pl it displays the header "This is a test"
:)>If I use https://www.mysite.com/tst.pl I get "Premature end of script headers".
:)>error.
:)
:)On Fri, 21 Mar 2003 15:22:04 +0000 (UTC), in comp.lang.perl.misc, Hemant Shah <shah@typhoon.xnet.com> wrote:
:)
:)>  For testing purposes I soft linked https directory to http directory, so 
:)>  the file is same
:)
:)>Did the sys admin miss something while configuring Apache or perl CGI.pm?
:)
:)It is possible that you can not run CGI scripts from a symlinked 
:)directory. Is the server Apache? If so, has it been configured to 
:)use suexec? You might need to check the suexec log
:)
:)Does the script work if you remove the symlink and put the script 
:)in the https directory?
:)
:)It might be simpler to use the same directory for both http and 
:)https
:)

  The problem was not with the symlink, but you pointed me in right direction.
  I talked with the sysadmin and found out that he had forgotten to add 
  +ExecCGI to the options header for the SSL host.

  Now everything is working fine.


:)-- 
:)Sharon

-- 
Hemant Shah                           /"\  ASCII ribbon campaign
E-mail: NoJunkMailshah@xnet.com       \ /  --------------------- 
                                       X     against HTML mail
TO REPLY, REMOVE NoJunkMail           / \      and postings      
FROM MY E-MAIL ADDRESS.           
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind,                Above opinions are mine only.
it's backed up on tape somewhere.      Others can have their own.


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

Date: Mon, 24 Mar 2003 14:46:54 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Problem with Getopt::Std and getopts()....
Message-Id: <yTEfa.4252$rw.882@nwrddc01.gnilink.net>

Michele Dondi wrote:
> On Sat, 22 Mar 2003 15:15:19 GMT, "Jürgen Exner"
> <jurgenex@hotmail.com> wrote:
>
>> Michele Dondi wrote:
>>> On 20 Mar 2003 16:36:36 -0800, clearguy02@yahoo.com (John Smith)
>>> wrote:
>>>> C:\>test.pl 1
>>>
>>> BTW: can you really run it like this (on Win* - as it seems)?!?
>>
>> Why not?
>
> Because on Windows (up to all of the versions I've been in contact
> with), executability is based upon a _naming convention_, for what
> regards the _command line_ interface.
>
>> Just create the correct association for the extension 'pl' (but
>> that's a Windows question, not a Perl question).
>
> Agreed, it's a Windows question and in this respect the association
> for any extension is set up for the GUI and has nothing to do with the
> command line, AFAIK (but then I've not been "working" with the most
> recent releases of the OS).

I'm not sure if a plain 16-bit DOS version of perl even exists (I highly
doubt it).
So for all practical purposes we are talking about the 32-bit Windows-based
cmd.exe command line interpreter, not the 16-bit command.com original DOS
shell.

jue




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

Date: 24 Mar 2003 15:38:02 GMT
From: Nicholas Dronen <ndronen@io.frii.com>
Subject: Re: Really weird?!?
Message-Id: <3e7f265a$0$191$75868355@news.frii.net>

Chris Lowth <please@no.spam> wrote:
CL> Michael Budash wrote:

>> In article <FHmfa.48$%l1.240@news13-win.server.ntlworld.com>,
>>  Chris Lowth <please@no.spam> wrote:
>> 
>>> Michael Budash wrote:
>>> 
>>> > In article <nh6fa.7$v6.24796@newsfep2-gui>,
>>> >  Chris Lowth <please@no.spam> wrote:

>>> >> Ryan Ritten wrote:

[ snip ]

>>> >> > print "key=$key\n";
>>> >> > print "table=$table\n";
>>> >> > if($key =~ /table$table!/)
>>> >> > {
>>> >> >         print "I'm in\n";
>>> >> > }

[ snip ]

>>> >> Problem is syntax of the "if($key..." line.
>>> >> 
>>> >> Fix thus...
>>> >> 
>>> >> $key = "blahtable4";
>>> >> $table = 4;
>>> >> print "key=$key\n";
>>> >> print "table=$table\n";
>>> >> if($key =~ m{table$table})
>>> >> {
>>> >>         print "I'm in\n";
>>> >> }

>>> > huh? there's nothing wrong with his syntax. these are equivalent:
>>> > 
>>> > /table$table!/
>>> > 
>>> > m{table$table!}
>>> > 
>>> > however, you changed his regex in the process - you left out the
>>> > exclamation point at the end...

>>> You are right about the "!" but wrong about the syntax (at least, for
>>> 5.6.1). Here's 5.6.1 at work....
>>> 
>>> [chris@jazz chris]$ cat x
>>> $key = "blahtable4!";
>>> $table = 4;
>>> print "key=$key\n";
>>> print "table=$table\n";
>>> if($key =~  table$table! )
>>              ^            ^
>>              ^            ^

>> uh, notice anything missing above? somehow, the forward slashes
>> surrounding the regex disappeared, causing the syntax error mentioned
>> below. the code with forward slashes passes syntax check.
>> 
>> [snip]
>> 

CL> Correct! - and if you note, the posters original script was missing those 
CL> slashes which is why I suggested correcting the syntax in the first place. 
CL> :)

Hi, Chris:

You're mistaken.  The OP's script's syntax is correct and contains
the requisite slashes.  See his post, or the snippet from his post
contained in this one.

Regards,

Nicholas


-- 
"Why shouldn't I top-post?"    http://www.aglami.com/tpfaq.html
"Meanings are another story."  http://www.ifas.org/wa/glossolalia.html


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

Date: Mon, 24 Mar 2003 17:15:33 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Really weird?!?
Message-Id: <mbudash-85FFBF.09153324032003@typhoon.sonic.net>

In article <Ixyfa.30$3j5.19161@newsfep1-win.server.ntli.net>,
 Chris Lowth <please@no.spam> wrote:

> Michael Budash wrote:
> 
> > In article <FHmfa.48$%l1.240@news13-win.server.ntlworld.com>,
> >  Chris Lowth <please@no.spam> wrote:
> > 
> >> Michael Budash wrote:
> >> 
> >> > In article <nh6fa.7$v6.24796@newsfep2-gui>,
> >> >  Chris Lowth <please@no.spam> wrote:
> >> > 
> >> >> Ryan Ritten wrote:
> >> >> 
> >> >> > I don't get it... all I want is to check to see if the string $key
> >> >> > contains the string of characters represented by table$table!
> >> >> > 
> >> >> > so for example... if $table was equal to 4 .... it would check $key
> >> >> > and see if the string table4! was found within it... here is my
> >> >> > code:
> >> >> > 
> >> >> > 
> >> >> > print "key=$key\n";
> >> >> > print "table=$table\n";
> >> >> > if($key =~ /table$table!/)
> >> >> > {
> >> >> >         print "I'm in\n";
> >> >> > }
> >> >> > 
> >> >> > if I run this... for example... I'd get :
> >> >> > 
> >> >> > key=blahtable4!
> >> >> > table=4
> >> >> > 
> >> >> > the if statement doesn't validate to true .... any ideas why?  it
> >> >> > should... I've tried chomping the data to remove any weird
> >> >> > characters at the end... with no luck... am I missing something
> >> >> > stupid?
> >> >> > 
> >> >> > thanx
> >> >> > 
> >> >> > -Ryan
> >> >> 
> >> >> Problem is syntax of the "if($key..." line.
> >> >> 
> >> >> Fix thus...
> >> >> 
> >> >> $key = "blahtable4";
> >> >> $table = 4;
> >> >> print "key=$key\n";
> >> >> print "table=$table\n";
> >> >> if($key =~ m{table$table})
> >> >> {
> >> >>         print "I'm in\n";
> >> >> }
> >> > 
> >> > huh? there's nothing wrong with his syntax. these are equivalent:
> >> > 
> >> > /table$table!/
> >> > 
> >> > m{table$table!}
> >> > 
> >> > however, you changed his regex in the process - you left out the
> >> > exclamation point at the end...
> >> > 
> >> 
> >> You are right about the "!" but wrong about the syntax (at least, for
> >> 5.6.1). Here's 5.6.1 at work....
> >> 
> >> [chris@jazz chris]$ cat x
> >> $key = "blahtable4!";
> >> $table = 4;
> >> print "key=$key\n";
> >> print "table=$table\n";
> >> if($key =~  table$table! )
> >              ^            ^
> >              ^            ^
> > 
> > uh, notice anything missing above? somehow, the forward slashes
> > surrounding the regex disappeared, causing the syntax error mentioned
> > below. the code with forward slashes passes syntax check.
> > 
> > [snip]
> > 
> 
> Correct! - and if you note, the poster's original script was missing those 
> slashes which is why I suggested correcting the syntax in the first place. 
> :)
> 
> Chris

assuming the poster's original script is quoted above, the slashes *are* 
there... something tells me you might've copied and pasted his code into 
a shell that dropped the slashes...

-- 
Michael Budash


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

Date: 24 Mar 2003 14:19:51 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: update value in flat file
Message-Id: <b5n467$art$1@mamenchi.zrz.TU-Berlin.DE>

Gunnar Hjalmarsson  <noreply@gunnar.cc> wrote in comp.lang.perl.misc:
> Anno Siegel wrote:
> > Blnukem <blnukem@hotmail.com> wrote in comp.lang.perl.misc:
> >>What would be the best way to update a value in a pipe delimited flat file
> >>say I wanted to update description3 quantity to 5. Should I read it all into
> >>an array update that value and then just reprint it?
> > 
> > perldoc -q 'line in a file'
> > 
> > After so many years you should know better than to ask a FAQ.
> 
> But the answer may differ nowadays, right?
> 
> Unless you don't have Perl v5.8, I suggest that you ignore the FAQ 
> answer, and use the Tie::File module instead.

Have you seen the answer in the 5.8.0 FAQ?  It says:

               Use the Tie::File module, which is included in the
               standard distribution since Perl 5.8.0.

:)

I may add that I'm not too happy with the new answer.  The former
version went to some length in explaining the frequent misunderstanding
that underlies the question.  Beginners tend to think that after

    $line = <FILE>;

changes made to $line are automatically reflected in the file.  With
the current FAQ they may continue to think so.

Anno


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

Date: Mon, 24 Mar 2003 15:33:56 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: update value in flat file
Message-Id: <b5n50u$2ag0vk$1@ID-184292.news.dfncis.de>

Anno Siegel wrote:
> Gunnar Hjalmarsson  <noreply@gunnar.cc> wrote in comp.lang.perl.misc:
>>Unless you don't have Perl v5.8, I suggest that you ignore the FAQ 
>>answer, and use the Tie::File module instead.
> 
> Have you seen the answer in the 5.8.0 FAQ?  It says:
> 
>                Use the Tie::File module, which is included in the
>                standard distribution since Perl 5.8.0.

Yes, I had seen it, and my point is that it differs from the answer in 
the 5.6.1 FAQ. If OP is using 5.6.1 or previous, he won't get the 
Tie::File recommendation by checking the FAQ.

/ Gunnar

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Mon, 24 Mar 2003 14:48:37 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: update value in flat file
Message-Id: <9VEfa.4263$rw.1685@nwrddc01.gnilink.net>

Blnukem wrote:
> What would be the best way to update a value in a pipe delimited flat
> file say I wanted to update description3 quantity to 5. Should I read
> it all into an array update that value and then just reprint it?

perldoc -q "change one line"

jue




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

Date: Mon, 24 Mar 2003 17:54:37 +0100
From: Matija Papec <mpapec@yahoo.com>
Subject: why heredoc? was: Re: print here-documents question
Message-Id: <60cu7vkrgfp8gim87rtq2dq9jkfmflceq1@4ax.com>

Bernard <bht@actrix.gen.nz> wrote:
>print <<"EOF"
><HTML>
><SCRIPT>
>var newLine = unescape("%0A");
>alert("The correct email format is : "  + newLine +
>"username\@domain.extension");
></SCRIPT>
></HTML>
>EOF

IMO, it looks terribly ugly; is there any reason why Perl manuals still use
it like an example of printing multiple lines?



-- 
Matija


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

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


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