[21941] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4163 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 22 18:06:03 2002

Date: Fri, 22 Nov 2002 15:05:13 -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           Fri, 22 Nov 2002     Volume: 10 Number: 4163

Today's topics:
        command-line output re-direction in winNT (George Eccles)
    Re: command-line output re-direction in winNT (Malcolm Dew-Jones)
    Re: command-line output re-direction in winNT <ian@WINDOZEdigiserv.net>
    Re: disambiguating print (was Re: Basic syntax question (Tad McClellan)
    Re: Format  a one line file to get two columns <krahnj@acm.org>
        PDF and Perl <philipp.moser@chello.at>
    Re: Perl/Tk install directories <gongwm@163.net>
    Re: Perl/Tk install directories <gongwm@163.net>
    Re: Perl/Tk install directories (kit)
        regex to match a multi line pattern (JimL.)
        search script and meta tags (Kevin McGurk)
    Re: search script and meta tags <flavell@mail.cern.ch>
    Re: search script and meta tags (Tad McClellan)
    Re: shtml and Perl <flavell@mail.cern.ch>
    Re: shtml and Perl <tjalbout@hotmail.com>
    Re: shtml and Perl <tjalbout@hotmail.com>
        Timers <ian@WINDOZEdigiserv.net>
        Tk not behaving as expected (by naive guy!) (Jan Fure)
    Re: Tk not behaving as expected (by naive guy!) <ian@WINDOZEdigiserv.net>
        today's perl quiz :-) <ronc@europa.com>
    Re: today's perl quiz :-) (Walter Roberson)
    Re: today's perl quiz :-) <ronc@europa.com>
        Whats the difference here...? (Brian Snyder)
    Re: Whats the difference here...? (Walter Roberson)
    Re: Whats the difference here...? (Tad McClellan)
        Windows XP / Perl Question btam01@ccsf.edu
    Re: Windows XP / Perl Question (Tad McClellan)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 22 Nov 2002 21:05:53 GMT
From: eccles@a-znet.com (George Eccles)
Subject: command-line output re-direction in winNT
Message-Id: <3dde9acb.373208215@news.a-znet.com>

perl, version 5.005_03 built for MSWin32-x86-object
WinNT, SP6A

NT cmd.exe window:
  c:> perl fnc.pl arg1 arg2  > outfile

Sends output to outfile.

  c:> fnc.pl arg1 arg2 

prints same output on console.

  c:> fnc.pl arg1 arg2  > outfile

Creates outfile, but it's empty.  Any clues as to why would be
appreciated. 

Thanks,
George


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


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

Date: 22 Nov 2002 13:44:53 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: command-line output re-direction in winNT
Message-Id: <3ddea555@news.victoria.tc.ca>

George Eccles (eccles@a-znet.com) wrote:
: perl, version 5.005_03 built for MSWin32-x86-object
: WinNT, SP6A

: NT cmd.exe window:
:   c:> perl fnc.pl arg1 arg2  > outfile

: Sends output to outfile.

:   c:> fnc.pl arg1 arg2 

: prints same output on console.

:   c:> fnc.pl arg1 arg2  > outfile

: Creates outfile, but it's empty.  Any clues as to why would be
: appreciated. 

I will guess the above is basically equivalent to

	C:> start dosbox-for-perl.pif > outfile

	The pif file then opens a window to run the script, the output is
	displayed in the window, and the window closes and the output is
	lost to view.

	You don't see the other window because the pif is configured to
	hide the window.

	The outfile only gets the output from the original "start"
	command, but there isn't any output from that.  In particular, the
	perl running in the other window does not have any redirection of
	it's output. 

I'm not suggesting that a pif file is actually used.  Just that the NT
file extension mechanism used to launch perl.exe probably uses the same
low level calls that would be used if there were a pif file, and the pif
file is easy to describe.  (A pif is similar to a .lnk file).

$0.02

However, a similar sounding problem about NT command line output and
redirection has been discussed once or more times before, so perhaps those
discussions might shed light on the matter. 




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

Date: Fri, 22 Nov 2002 22:45:43 GMT
From: Ian.H <ian@WINDOZEdigiserv.net>
Subject: Re: command-line output re-direction in winNT
Message-Id: <hscttucco818hua8qgslqs31jnlgis51lm@4ax.com>
Keywords: Remove WINDOZE to reply

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

In a fit of excitement on Fri, 22 Nov 2002 21:05:53 GMT,
eccles@a-znet.com (George Eccles) managed to scribble:

> perl, version 5.005_03 built for MSWin32-x86-object
> WinNT, SP6A
> 
> NT cmd.exe window:
>   c:> perl fnc.pl arg1 arg2  > outfile
> 
> Sends output to outfile.
> 
>   c:> fnc.pl arg1 arg2 
> 
> prints same output on console.
> 
>   c:> fnc.pl arg1 arg2  > outfile
> 
> Creates outfile, but it's empty.  Any clues as to why would be
> appreciated. 

George,

Maybe a weird question, but does fnc.pl actually write anything to
STDOUT? I don't know what code you have in that file, so taking a stab
in the dark so to speak.


Regards,

  Ian

-----BEGIN xxx SIGNATURE-----
Version: PGP Personal Privacy 6.5.3

iQA/AwUBPd6z42fqtj251CDhEQJVTACfexROtRmYtStIll0JgMTguE4JeQEAoNMM
zlPLWtw1pCjkDgRHp8l77spY
=assT
-----END PGP SIGNATURE-----

-- 
Ian.H  (Design & Development)
digiServ Network - Web solutions
www.digiserv.net  |  irc.digiserv.net  |  forum.digiserv.net
Scripting, Web design, development & hosting.


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

Date: Fri, 22 Nov 2002 15:40:30 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: disambiguating print (was Re: Basic syntax question on using arrays  returned from function)
Message-Id: <slrnatt92e.540.tadmc@magna.augustmail.com>

Dave Tweed <dtweed@acm.org> wrote:
> Tad McClellan wrote:
>> I feel it is much easier to remember (and to recall) if I
>> just choose to put parens around my arg list in the few
>> cases where I otherwise have the above pattern that
>> triggers guessing by the parser:
>> 
>>    print( (), ... );  # now the guess turns out to be what I intended
> 
> I still find it confusing that this doesn't work as I expect if the first
> argument is a function call that the parser doesn't know about yet. In
> other words, given
> 
>    perl -we "print (foo ('x')); sub foo {'Hi'}"
> 
> the parser still thinks that foo is meant to be a filehandle, 


That is a completely separate thing from the earlier discussion.

   Subject: disambiguating print

Was a poor choice on my part, as we were discussing disambiguating
function arg lists. That is, all functions, not just the
particular print() function.

This new issue is about filehandles not being first class data types.


So in your case above, I would _still_ not resort to unary plus
('cause I'd still have to pause and figure out what the trickery
was for).

In that case, if Perl wants a filehandle, I'd just give it a filehandle:

   print STDOUT (foo ('x'));

or

   print (STDOUT foo ('x'));


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


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

Date: Fri, 22 Nov 2002 22:43:49 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Format  a one line file to get two columns
Message-Id: <3DDEB2E7.B9A772B1@acm.org>

"David K. Wall" wrote:
> 
> John W. Krahn <krahnj@acm.org> wrote on 21 Nov 2002:
> >
> > This will only read blocks of 1K
> >
> > #!/usr/bin/perl
> > use warnings;
> > use strict;
> >
> > $/ = \1024;
> 
> That's a feature of $/ I hadn't noticed before.  I'll have to
> remember it.  What's the advantage over sysread()?

It's shorter?  :-)


> > while ( <> ) {
> >     s/\s+/--$| ? ' ' : "\n"/eg;
> >     s/\D*\z/\n/ if eof ARGV;
> >     print;
> >     }
> >
> > __END__
> 
> Very clever.  I like that much better than my little kluge or even
> the slurping way.
> 
> I just had to play with it a little and get $| out of it.  Switching
> the flushing on and off like that bothers me somehow.
> 
> my $flipflop = 0;
> while ( <> ) {
>     s/\s+/($flipflop = ++$flipflop % 2) ? ' ' : "\n"/eg;

      s/\s+/($flipflop %= 2)++ ? "\n" : ' '/eg;


>     s/\S*\z/\n/ if eof ARGV;
>     print;
> }



John
-- 
use Perl;
program
fulfillment


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

Date: Fri, 22 Nov 2002 22:13:41 GMT
From: Philipp Moser <philipp.moser@chello.at>
Subject: PDF and Perl
Message-Id: <p_xD9.34398$up.396016@news.chello.at>

Does anybody know a good tutorial for PDFLib.

I would like to convert xsl:fo to PDF with PDFLib an 
XML::Lib. Would be a great projekt. maybe a module?
Please help
cu Philipp

(crossposting to de.comp.lang.perl.misc, after converting to 
german)
-- 
XML is the ASCII for the new millenium.
(Cocoon documentation)
--------------------------------------



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

Date: Sat, 23 Nov 2002 03:06:31 +0800
From: "Kurt Gong" <gongwm@163.net>
Subject: Re: Perl/Tk install directories
Message-Id: <arlv69$19fn$1@mail.cn99.com>


Pierre Asselin <pa@panix.com> wrote in message
news:arlqi2$o8l$1@reader1.panix.com...
> I noticed that Perl/Tk 800.024 tries to install in /usr/local/lib/*
> instead of /usr/local/lib/perl5/* like the other CPAN modules.  Is
> this intentional?
>
> For what it's worth, forcing the install to lib/perl5/* produces a
> perfectly functional module.
>




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

Date: Sat, 23 Nov 2002 03:09:47 +0800
From: "Kurt Gong" <gongwm@163.net>
Subject: Re: Perl/Tk install directories
Message-Id: <arlvcd$19hg$2@mail.cn99.com>


Pierre Asselin <pa@panix.com> wrote in message
news:arlqi2$o8l$1@reader1.panix.com...
> I noticed that Perl/Tk 800.024 tries to install in /usr/local/lib/*
> instead of /usr/local/lib/perl5/* like the other CPAN modules.  Is
> this intentional?
>
> For what it's worth, forcing the install to lib/perl5/* produces a
> perfectly functional module.
>




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

Date: 22 Nov 2002 14:53:40 -0800
From: manutd_kit@yahoo.com (kit)
Subject: Re: Perl/Tk install directories
Message-Id: <1751b2b5.0211221453.4866c072@posting.google.com>

This may be help,

http://www.perl.com/pub/a/2001/03/gui.html

I learnt how to install perl/tk in here.

Kit


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

Date: 22 Nov 2002 15:03:09 -0800
From: jimr.long@worldnet.att.net (JimL.)
Subject: regex to match a multi line pattern
Message-Id: <f16594a7.0211221503.302b3b9a@posting.google.com>

all,
   I am trying to match a pattern that has multiple lines. I have
found some success, but have hit the wall...

I need a regex that will match:
21 NOV 02  03:17:57PM
*** Today I found God
00000   24C00000 84000000 00003975 9A970100   *$.........9u....*^M
00010   90160000 30010100 03000558 003FFFFF   *....0......X.?..*^M

but not:
21 NOV 02  03:17:57PM
*** Today I found blah-foo
00000   24C00000 84000000 00003975 9A970100   *$.........9u....*^M
00010   90160000 30010100 03000558 003FFFFF   *....0......X.?..*^M

I have been trying:
while(<FILE>){
        print if /^\d{2}\s{1}\D{3}/ .. /^00010.*/;  
             #PerlFAQ..
            }

But can't seem to get any further.
Thanks in advance for feedback,
Jim


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

Date: 22 Nov 2002 11:26:41 -0800
From: kgmmusic@comcast.net (Kevin McGurk)
Subject: search script and meta tags
Message-Id: <805e32e3.0211221126.4737a6ba@posting.google.com>

Hi all!
I'm using a search script called FMSEARCH
(http://www.focalmedia.net/fmsitesearch.html) and have it configured
and working good. However, my client has requested that I use the same
meta tags for keywords on all pages to improve search engine rankings.
This poses a problem as the FMSEARCH script utilizes the meta tags as
well and for example if a customer searches for the word "bandana" and
that word is in the meta tag keywords the search will list every
single page.

I'm by no means a Perl guru but would like to know if it is possible
the have the script ignore the meta tags entirely so as to overcome
this problem.

PLEASE REPLY BY EMAIL AS I RARELY HAVE ACCESS TO THESE GROUPS.

Thanks in advance!

Kevin McGurk
kgmmusic@comcast.net


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

Date: Fri, 22 Nov 2002 20:35:15 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: search script and meta tags
Message-Id: <Pine.LNX.4.40.0211222032350.9178-100000@lxplus076.cern.ch>

On Nov 22, Kevin McGurk inscribed on the eternal scroll:

> and working good. However, my client has requested that I use the same
> meta tags for keywords on all pages to improve search engine rankings.

Great.  Any halfways decent search engine will disqualify the whole
site for keyword spamming.  What was your Perl question?

> I'm by no means a Perl guru but would like to know if it is possible
> the have the script ignore the meta tags entirely

Yes.

> so as to overcome this problem.

There isn't a problem; at least there isn't one until you create it.

> PLEASE REPLY BY EMAIL AS I RARELY HAVE ACCESS TO THESE GROUPS.

Have a nice weekend.  Is it just me or is this a happy plonk day?




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

Date: Fri, 22 Nov 2002 15:03:54 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: search script and meta tags
Message-Id: <slrnatt6tq.50m.tadmc@magna.augustmail.com>

Kevin McGurk <kgmmusic@comcast.net> wrote:

> PLEASE REPLY BY EMAIL AS I RARELY HAVE ACCESS TO THESE GROUPS.


   *plonk*


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


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

Date: Fri, 22 Nov 2002 20:12:00 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: shtml and Perl
Message-Id: <Pine.LNX.4.40.0211222011080.9178-100000@lxplus076.cern.ch>

On Nov 22, Talid inscribed on the eternal scroll:

> That would be fine if I was running apache :)
> I'm using Abyss X1 on win32 machine.

Even more good reason not to raise off-topic questions here.

And you're killfiled for top-posting with fullquote.  Bye.





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

Date: Fri, 22 Nov 2002 20:15:57 GMT
From: "Talid" <tjalbout@hotmail.com>
Subject: Re: shtml and Perl
Message-Id: <1gwD9.62571$ka.1854802@news1.calgary.shaw.ca>

You know what, thanks for the info Alan, now I know what to do.
My intent was to figure this out, not annoy you.

Cheers,
-t

"Alan J. Flavell" <flavell@mail.cern.ch> wrote in message
news:Pine.LNX.4.40.0211222011080.9178-100000@lxplus076.cern.ch...
> On Nov 22, Talid inscribed on the eternal scroll:
>
> > That would be fine if I was running apache :)
> > I'm using Abyss X1 on win32 machine.
>
> Even more good reason not to raise off-topic questions here.
>
> And you're killfiled for top-posting with fullquote.  Bye.
>
>
>




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

Date: Fri, 22 Nov 2002 20:17:07 GMT
From: "Talid" <tjalbout@hotmail.com>
Subject: Re: shtml and Perl
Message-Id: <7hwD9.62574$ka.1855003@news1.calgary.shaw.ca>

Agreed, I apologise for the inconvenience. First time news users. :P
-T

"> Here's a suggestion:  crosspost your questions instead of multiposting
> them.  You have followups here and in alt.perl, but they're in
> completely different threads.
>
> --
> David K. Wall - usenet@dwall.fastmail.fm
> "Oook."




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

Date: Fri, 22 Nov 2002 21:59:18 GMT
From: Ian.H <ian@WINDOZEdigiserv.net>
Subject: Timers
Message-Id: <io9ttucuesolvb8thtl1aqc4r99gpqpe2g@4ax.com>
Keywords: Remove WINDOZE to reply

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Evening all (depending on location) =)

Not so long ago, I wrote an IRC bot for my server using the Net::IRC
and Net::IRC::Event modules (yup, I'm aware that Net::IRC is
depreciated), and I'm looking to include a timer event.

I've looked in the doc at the alarm() function, but this doesn't seem
to be what I'm after, likewise, I've searched CPAN for timer modules,
and there appears to be a varied selection.

The bot uses a mySQL backend to control a banlist amongst other things,
and I'd like to initiate temp bans of say... 5 mins.

- From what I read about alarm(), this wouldn't work (I maybe wrong of
course). Could anyone give any pointers as to a possibly recommended
module to look at to achive a timer which is running inside a permanent
loop? I'm thinking I probably need to fork/thread the timer so that it
runs in the background, outside of the loop. I haven't done much at all
in the lines of using the fork() function, but am willing to research
on how to use that, and to implement the module, it's just.. I'm unsure
out of all the ones listed, as to what may be my best shot.

I think I need to use something like 'nick' and 'timestamp' stored
somewhere, and a timer that would tick over for 5 mins from that
timestamp for that nick. Also, there may be more than one nick at any
time on a temp ban, meaning that I'd need to start a new thread per
nick (I think)?

Any info/advice/suggestions more than welcome.

TIA.


Regards,

  Ian

-----BEGIN xxx SIGNATURE-----
Version: PGP Personal Privacy 6.5.3

iQA/AwUBPd6pAmfqtj251CDhEQJ2jQCgziwGzF3gNOjpKP4KWWNcoQ0qkxgAoLWU
wBSHhezb0DrRjFTnqrFKusmo
=klDL
-----END PGP SIGNATURE-----

-- 
Ian.H  (Design & Development)
digiServ Network - Web solutions
www.digiserv.net  |  irc.digiserv.net  |  forum.digiserv.net
Scripting, Web design, development & hosting.


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

Date: 22 Nov 2002 12:38:32 -0800
From: jan_may2002_fure@attbi.com (Jan Fure)
Subject: Tk not behaving as expected (by naive guy!)
Message-Id: <e47a84bf.0211221238.3d7b8520@posting.google.com>

Hi;

I am new to Tk (just installed the module), and I am trying to
integrate a file dialog into one of my perl scripts. The lines below
don't do what I expected (I borrowed the GUI commands from Slaven
Rezic's article (http://www.perltk.org/articles/filedialogs/filedialogs.html)):

my $top = new MainWindow;
my $fs = $top->FileSelect(-verify => [qw/-d/]);
print $fs->Show;
print "\n";
# Lines above opens file dialog and prints the name of the 
# Lines below fail to hand the directory name over to $dirname which
is utilized in the rest of the script
my $dirname = $fs;
print "You selected $dirname!\n";

$dirname is now some kind of hash reference, The print statement
outputs:
You selected Tk::Fileselect=HASH(0x27fafa8)!

I am sure Perl is doing exactly what I tell it!!

How can I aquire a filehandle or dirhandle after I select a directory
using the GUI?

Jan Fure


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

Date: Fri, 22 Nov 2002 20:46:18 GMT
From: Ian.H <ian@WINDOZEdigiserv.net>
Subject: Re: Tk not behaving as expected (by naive guy!)
Message-Id: <et5ttu0fcdq49g5t9gfsu7n50e0n97tfkj@4ax.com>
Keywords: Remove WINDOZE to reply

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

In a fit of excitement on 22 Nov 2002 12:38:32 -0800,
jan_may2002_fure@attbi.com (Jan Fure) managed to scribble:

> Hi;
> 
> I am new to Tk (just installed the module), and I am trying to
> integrate a file dialog into one of my perl scripts. The lines below
> don't do what I expected (I borrowed the GUI commands from Slaven
> Rezic's article
> (http://www.perltk.org/articles/filedialogs/filedialogs.html)):  
> 
> my $top = new MainWindow;
> my $fs = $top->FileSelect(-verify => [qw/-d/]);
> print $fs->Show;
> print "\n";
> # Lines above opens file dialog and prints the name of the 
> # Lines below fail to hand the directory name over to $dirname which
> is utilized in the rest of the script
> my $dirname = $fs;
> print "You selected $dirname!\n";
> 
> $dirname is now some kind of hash reference, The print statement
> outputs:
> You selected Tk::Fileselect=HASH(0x27fafa8)!
> 
> I am sure Perl is doing exactly what I tell it!!
> 
> How can I aquire a filehandle or dirhandle after I select a directory
> using the GUI?

Jan,

Have you tried:

  my $dirname = $fs->get;


Regards,

  Ian

-----BEGIN xxx SIGNATURE-----
Version: PGP Personal Privacy 6.5.3

iQA/AwUBPd6X42fqtj251CDhEQLuAgCgjFdqzWaJCr1e6i69EEcEqoIRbv4AoJOb
erfFKMqySAnoUqljIqvu4jEQ
=DmHx
-----END PGP SIGNATURE-----

-- 
Ian.H  (Design & Development)
digiServ Network - Web solutions
www.digiserv.net  |  irc.digiserv.net  |  forum.digiserv.net
Scripting, Web design, development & hosting.


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

Date: Fri, 22 Nov 2002 20:58:12 GMT
From: Ronald O. Christian <ronc@europa.com>
Subject: today's perl quiz :-)
Message-Id: <cc6ttusrveqnsktr07orb138p42kgfgh88@4ax.com>


Folks, I'm trying to come up with a perl expression that will saw off
the version number of a red hat rpm package and leave only the package
name.  It has to work correctly for:

name-3.2.3.-5
package-name-3.5.22-5
long-package-name-2.6-4

The output being:

name
package-name
long-package-name

Obviously there needs to be some kind of recursion or sequential
processing, but it's beyond my current, rather feeble perl prowess.
Ideas welcome.  I'm hoping to learn something out of this.

Thank you.

	Ron

http://roc85.home.attbi.com


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

Date: 22 Nov 2002 21:01:55 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: today's perl quiz :-)
Message-Id: <arm603$aa6$1@canopus.cc.umanitoba.ca>

In article <cc6ttusrveqnsktr07orb138p42kgfgh88@4ax.com>,
Ronald O. Christian  <ronc@europa.com> wrote:
:Folks, I'm trying to come up with a perl expression that will saw off
:the version number of a red hat rpm package and leave only the package
:name.  It has to work correctly for:

:name-3.2.3.-5
:package-name-3.5.22-5
:long-package-name-2.6-4

s/[0-9.-]*$//
--
Would you buy a used bit from this man??


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

Date: Fri, 22 Nov 2002 21:18:50 GMT
From: Ronald O. Christian <ronc@europa.com>
Subject: Re: today's perl quiz :-)
Message-Id: <qq7ttu844tplf7kh53mcvmv34rdr5djoa4@4ax.com>

On 22 Nov 2002 21:01:55 GMT, roberson@ibd.nrc.ca (Walter Roberson)
wrote:

>In article <cc6ttusrveqnsktr07orb138p42kgfgh88@4ax.com>,
>Ronald O. Christian  <ronc@europa.com> wrote:
>:Folks, I'm trying to come up with a perl expression that will saw off
>:the version number of a red hat rpm package and leave only the package
>:name.  It has to work correctly for:
>
>:name-3.2.3.-5
>:package-name-3.5.22-5
>:long-package-name-2.6-4
>
>s/[0-9.-]*$//

Yeesh...  Thanks, man.  Obviously I was attacking the problem from the
wrong direction.


	Ron

http://roc85.home.attbi.com


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

Date: 22 Nov 2002 12:05:07 -0800
From: bsnyder030174@yahoo.com (Brian Snyder)
Subject: Whats the difference here...?
Message-Id: <668c9529.0211221205.6f2054ee@posting.google.com>

Hello, I'm curious what why the parenthesis are needed in the
following comparison....


$x = '1 2 3 4 5 6 a b c d -od abcd1234 y t tr';
my ($a) = ($x =~ /-od (\w+)/);
print $a
Answer--->    abcd1234


Thats what I want, however if I leave out the () around the $a in the
reg exp line so I have this:
my $a = ($x =~ /-od (\w+)/);

Then $a is equal to '1'.

Im assuming the '1' is equivalent to 'successfull match', however,
what syntactical difference is perl exploiting here so that it
understand I want the value in the return code by putting the $a in
parens?

Thanx,
  --brian


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

Date: 22 Nov 2002 20:33:53 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: Whats the difference here...?
Message-Id: <arm4bh$9l0$1@canopus.cc.umanitoba.ca>

In article <668c9529.0211221205.6f2054ee@posting.google.com>,
Brian Snyder <bsnyder030174@yahoo.com> wrote:
:Hello, I'm curious what why the parenthesis are needed in the
:following comparison....

:my ($a) = ($x =~ /-od (\w+)/);

:Thats what I want, however if I leave out the () around the $a in the
:reg exp line so I have this:
:my $a = ($x =~ /-od (\w+)/);

:Then $a is equal to '1'.

my ($a)  gives a list context to the expression.
my $a    gives a scalar context to the expression.

     /PATTERN/cgimosx
             Searches a string for a pattern match, and in scalar context
             returns true (1) or false ('')
--
What is "The Ultimate Meme"? Would it, like Monty Python's
"The World's Funniest Joke", lead to the deaths of everyone who
encountered it? Ideas *have* lead to the destruction of entire cultures.
   -- A Child's Garden Of Memes


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

Date: Fri, 22 Nov 2002 15:12:41 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Whats the difference here...?
Message-Id: <slrnatt7e9.50m.tadmc@magna.augustmail.com>

Brian Snyder <bsnyder030174@yahoo.com> wrote:
> Hello, I'm curious what why the parenthesis are needed in the
> following comparison....


There are 3 sets of parenthesis, which set do you mean?


> $x = '1 2 3 4 5 6 a b c d -od abcd1234 y t tr';
> my ($a) = ($x =~ /-od (\w+)/);
            ^                 ^
            ^                 ^  these are unnecessary

Here the m// is in "list context".


> print $a
> Answer--->    abcd1234
> 
> 
> Thats what I want, however if I leave out the () around the $a in the
> reg exp line so I have this:
> my $a = ($x =~ /-od (\w+)/);
> 
> Then $a is equal to '1'.


Here the m// is in "scalar context".


> Im assuming the '1' is equivalent to 'successfull match', however,
> what syntactical difference is perl exploiting here 


See the "Context" section in:

   perldoc perldata


> so that it
> understand I want the value in the return code by putting the $a in
> parens?


When I intend to capture a _single value_, I don't use m// in
a list context.

In that case I would:

   my $a = $1 if $x =~ /-od (\w+)/;


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


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

Date: Fri, 22 Nov 2002 12:19:28 -0800
From: btam01@ccsf.edu
Subject: Windows XP / Perl Question
Message-Id: <Pine.HPX.4.44.0211221216450.8887-100000@hills.ccsf.cc.ca.us>

I have a perl script that cleans out certain directories in Windows XP.
How would I setup the computer so that this script would run automatically
right before I shut down my computer?

Thanks,
Bill



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

Date: Fri, 22 Nov 2002 15:14:06 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Windows XP / Perl Question
Message-Id: <slrnatt7gu.50m.tadmc@magna.augustmail.com>

btam01@ccsf.edu <btam01@ccsf.edu> wrote:
> I have a perl script that cleans out certain directories in Windows XP.
> How would I setup the computer so that this script would run automatically
> right before I shut down my computer?


The same way you would set it up if it was written in Python
or Java or C++ or...

You have a Windows question, not a Perl question.

Try asking in a Windows newsgroup.


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


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