[18700] in Perl-Users-Digest
Perl-Users Digest, Issue: 868 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 10 09:10:31 2001
Date: Thu, 10 May 2001 06:10:14 -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: <989500213-v10-i868@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 10 May 2001 Volume: 10 Number: 868
Today's topics:
Need help <Per-fredrik.Pollnow@epk.ericsson.se>
Re: Need help (Anno Siegel)
OZ as a beginners' banguage? <reply-via@my-web-site.com>
Re: OZ as a beginners' banguage? <andrew@andrewcooke.free-online.co.uk>
Re: Pattern matching using variable ... <bart.lateur@skynet.be>
Re: Pattern matching using variable ... <tinamue@zedat.fu-berlin.de>
Re: Pattern matching using variable ... <bart.lateur@skynet.be>
Re: Pattern matching using variable ... <tinamue@zedat.fu-berlin.de>
perldoc-Seiten in Dokument einbinden <christian.meisl@tugraz.at>
pod + vgrind ? <nospam@yale.edu>
Re: problem with perlapp (PDK 2.1) <nutcracker@no-spam.org>
Re: problem with perlapp (PDK 2.1) <wyzelli@yahoo.com>
Re: problem with perlapp (PDK 2.1) <nutcracker@no-spam.org>
Re: Question about "->" operator <gtoomey@usa.net>
Re: Reading from empty file handle OR from a pipe (Anno Siegel)
thank you! <eng80956@nus.edu.sg>
Re: weird error on @array syntax <godzilla@stomp.stomp.tokyo>
Re: Win32::ODBC hangs unless I run with "-d" (Philip Lees)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 10 May 2001 13:44:05 +0200
From: "Per- Fredrik Pollnow" <Per-fredrik.Pollnow@epk.ericsson.se>
Subject: Need help
Message-Id: <9ddu9n$dq5$1@newstoo.ericsson.se>
Hi,
Can someone please help me........... I have tried and tried but I can't get
it to work
The thing is that I want the AVE value form the VMS_ING_SYS row and
DB_LOC_01 row printed in to a file.
This is what I have:
use strict;
my ($d, $x, @z);
open (DISK, "MONI_DISK.LOG") || die "Can't open file $!\n";
open (NEW, "> new.txt") || die "Can't open file $!\n";
print "WMS_ING_SYS\tDB_LOC_01\n";
while ($x = <DISK>) {
$x =~ s/[^:]+://;
$x =~ s/[^\s]*\w//;
$x =~ s/[)]//;
$x =~ s/[\s]+//;
@z = (split / /, $x);
foreach ($z[0] =~ /VMS_ING_SYS/) {
print "$z[16]\t\t";
}
foreach ($z[0] =~ /DB_LOC_01/) {
print "$z[16]\n";
}
}
Ok, I don't get all the numbers printed when I run the program, it's
probably the spaces between the text, but I can't get the spaces to
disappear.. that's why split fucks it all up I think.
so if someone is god at Regular Expression and takes the spaces away and
replaces it with one space only.
Thanx.....
This is the DATA
I/O Operation Rate CUR
AVE MIN MAX
XXX XXX
$1$DKC100: (PPAS01) VMS_ING_SYS 0.00 0.74 0.00
4.18
$1$DKC102: (PPAS01) DB_LOC_02 2.75 4.89 2.66
7.13
$1$DKC104: (PPAS01) PPAS_SYS 0.00 0.00 0.00
0.00
$1$DKC200: (PPAS01) ING_LOG 5.93 6.36 5.15
7.16
$1$DKC201: (PPAS01) DB_LOC_01 8.91 10.45 8.11
11.93
$1$DKC202: (PPAS01) ING_CKP 0.00 0.00 0.00
0.00
$1$DKC300: (PPAS01) ING_DMP_JNL 0.00 0.57 0.00
1.20
$1$DKC301: (PPAS01) DB_LOC_05 2.88 3.56 2.59
4.71
$1$DKD204: (PPAS01) PPAS_USERS 69.09 71.02 59.29
81.66
$1$DKD302: (PPAS01) DB_LOC_04 1.48 2.85 1.31
4.53
$1$DKD400: (PPAS01) ING_WRK 0.00 0.00 0.00
0.00
$1$DKD402: (PPAS01) DB_LOC_03 5.56 8.22 4.69
11.33
$1$DKC100: (PPAS01) VMS_ING_SYS 0.00 0.78 0.00
4.69
$1$DKC102: (PPAS01) DB_LOC_02 4.00 5.06 2.28
7.73
$1$DKC104: (PPAS01) PPAS_SYS 0.00 0.01 0.00
0.53
$1$DKC200: (PPAS01) ING_LOG 7.43 6.68 5.15
8.25
$1$DKC201: (PPAS01) DB_LOC_01 10.80 10.93 8.01
14.53
$1$DKC202: (PPAS01) ING_CKP 0.00 0.00 0.00
0.00
$1$DKC300: (PPAS01) ING_DMP_JNL 0.00 0.63 0.00
1.29
$1$DKC301: (PPAS01) DB_LOC_05 2.76 3.81 2.51
5.18
$1$DKD204: (PPAS01) PPAS_USERS 77.05 75.15 59.29
90.66
$1$DKD302: (PPAS01) DB_LOC_04 1.85 3.00 1.29
5.33
$1$DKD400: (PPAS01) ING_WRK 0.00 0.00 0.00
0.10
$1$DKD402: (PPAS01) DB_LOC_03 7.00 8.59 4.69
12.43
$1$DKC100: (PPAS01) VMS_ING_SYS 1.13 0.82 0.00
4.69
$1$DKC102: (PPAS01) DB_LOC_02 5.94 5.06 1.98
7.73
$1$DKC104: (PPAS01) PPAS_SYS 0.00 0.01 0.00
0.53
$1$DKC200: (PPAS01) ING_LOG 6.50 6.67 5.15
8.25
$1$DKC201: (PPAS01) DB_LOC_01 10.94 10.89 8.01
14.53
$1$DKC202: (PPAS01) ING_CKP 0.00 0.00 0.00
0.00
$1$DKC300: (PPAS01) ING_DMP_JNL 1.20 0.65 0.00
1.29
$1$DKC301: (PPAS01) DB_LOC_05 4.30 3.80 2.51
5.18
$1$DKD204: (PPAS01) PPAS_USERS 79.15 74.66 59.29
90.66
$1$DKD302: (PPAS01) DB_LOC_04 4.01 3.03 1.29
5.33
$1$DKD400: (PPAS01) ING_WRK 0.00 0.00 0.00
0.10
$1$DKD402: (PPAS01) DB_LOC_03 10.21 8.67 4.69
12.43
$1$DKC100: (PPAS01) VMS_ING_SYS 0.60 0.77 0.00
4.69
$1$DKC102: (PPAS01) DB_LOC_02 7.43 5.02 1.98
7.73
$1$DKC104: (PPAS01) PPAS_SYS 0.00 0.00 0.00
0.53
$1$DKC200: (PPAS01) ING_LOG 7.30 6.63 5.15
8.25
$1$DKC201: (PPAS01) DB_LOC_01 12.98 10.80 8.01
14.53
$1$DKC202: (PPAS01) ING_CKP 0.00 0.00 0.00
0.00
$1$DKC300: (PPAS01) ING_DMP_JNL 1.01 0.64 0.00
1.29
$1$DKC301: (PPAS01) DB_LOC_05 4.48 3.74 2.31
5.18
$1$DKD204: (PPAS01) PPAS_USERS 69.43 73.47 58.09
90.66
$1$DKD302: (PPAS01) DB_LOC_04 4.59 3.01 1.29
5.33
$1$DKD400: (PPAS01) ING_WRK 0.00 0.00 0.00
0.10
$1$DKD402: (PPAS01) DB_LOC_03 11.61 8.62 4.69
12.43
------------------------------
Date: 10 May 2001 12:50:03 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Need help
Message-Id: <9de2pr$4m8$1@mamenchi.zrz.TU-Berlin.DE>
According to Per- Fredrik Pollnow <Per-fredrik.Pollnow@epk.ericsson.se>:
> Hi,
> Can someone please help me........... I have tried and tried but I can't get
> it to work
> The thing is that I want the AVE value form the VMS_ING_SYS row and
> DB_LOC_01 row printed in to a file.
> This is what I have:
>
> use strict;
> my ($d, $x, @z);
> open (DISK, "MONI_DISK.LOG") || die "Can't open file $!\n";
> open (NEW, "> new.txt") || die "Can't open file $!\n";
>
> print "WMS_ING_SYS\tDB_LOC_01\n";
> while ($x = <DISK>) {
> $x =~ s/[^:]+://;
> $x =~ s/[^\s]*\w//;
> $x =~ s/[)]//;
> $x =~ s/[\s]+//;
> @z = (split / /, $x);
The following foreach loops are not only mis-indented, they are
most probably mis-constructed. I can't make out what they are
supposed to do. In particular, I don't see how you expect to
get more than 16 elements in @z. From your data I'd expect five.
> foreach ($z[0] =~ /VMS_ING_SYS/) {
> print "$z[16]\t\t";
> }
> foreach ($z[0] =~ /DB_LOC_01/) {
> print "$z[16]\n";
> }
> }
[data snipped]
Your data didn't quite make it intact to my server, so I'm partially
guessing, but this should put you on the right track:
Anno
#!/usr/local/bin/perl
use warnings; use strict; $| = 1;
use QuickFix;
while ( <DATA> ) {
chomp;
next unless my ( $what, $ave) = /
(?: # grouping parenthesis (no capture)
\S+\s+ # non-spaces followed by spaces
){2} # two of the above
(VMS_ING_SYS|DB_LOC_01) # ...followed by either of these.
# we capture this bit in $what
\s+ # more spaces
\d+\.+\d+ # a decimal number we don't want
\s+ # separator
(\d+\.+\d+) # another decimal. this one we do
# want in $ave
# we can ignore everything else
/x;
print "$what $ave\n";
}
__DATA__
I/O Operation Rate CUR AVE MIN MAX XXX XXX
$1$DKC100: (PPAS01) VMS_ING_SYS 0.00 0.74 0.00 4.18
$1$DKC102: (PPAS01) DB_LOC_02 2.75 4.89 2.66 7.13
$1$DKC104: (PPAS01) PPAS_SYS 0.00 0.00 0.00 0.00
$1$DKC200: (PPAS01) ING_LOG 5.93 6.36 5.15 7.16
$1$DKC201: (PPAS01) DB_LOC_01 8.91 10.45 8.11 11.93
$1$DKC202: (PPAS01) ING_CKP 0.00 0.00 0.00 0.00
$1$DKC300: (PPAS01) ING_DMP_JNL 0.00 0.57 0.00 1.20
$1$DKC301: (PPAS01) DB_LOC_05 2.88 3.56 2.59 4.71
$1$DKD204: (PPAS01) PPAS_USERS 69.09 71.02 59.29 81.66
$1$DKD302: (PPAS01) DB_LOC_04 1.48 2.85 1.31 4.53
$1$DKD400: (PPAS01) ING_WRK 0.00 0.00 0.00 0.00
$1$DKD402: (PPAS01) DB_LOC_03 5.56 8.22 4.69 11.33
$1$DKC100: (PPAS01) VMS_ING_SYS 0.00 0.78 0.00 4.69
$1$DKC102: (PPAS01) DB_LOC_02 4.00 5.06 2.28 7.73
$1$DKC104: (PPAS01) PPAS_SYS 0.00 0.01 0.00 0.53
$1$DKC200: (PPAS01) ING_LOG 7.43 6.68 5.15 8.25
$1$DKC201: (PPAS01) DB_LOC_01 10.80 10.93 8.01 14.53
$1$DKC202: (PPAS01) ING_CKP 0.00 0.00 0.00 0.00
$1$DKC300: (PPAS01) ING_DMP_JNL 0.00 0.63 0.00 1.29
------------------------------
Date: Thu, 10 May 2001 10:02:54 +0200
From: "Biep @ http://www.biep.org/" <reply-via@my-web-site.com>
Subject: OZ as a beginners' banguage?
Message-Id: <9ddhrd$i1k5i$1@ID-63952.news.dfncis.de>
On a related note, what would people think of OZ as a beginners' language?
(http://www.mozart-oz.org) Is it used anywhere as such?
--
Biep
Reply via http://www.biep.org
------------------------------
Date: Thu, 10 May 2001 09:06:48 +0100
From: Andrew Cooke <andrew@andrewcooke.free-online.co.uk>
Subject: Re: OZ as a beginners' banguage?
Message-Id: <3AFA4C18.D192E46@andrewcooke.free-online.co.uk>
There's a book in draft form that uses Oz to introduce programming in a
range of styles - I'd think it would be a very good way to learn (but I
guess it would depend a lot on the student - I'm thinking of the kind of
student who'd enjoy SICP, not the kind who's wondering what the mouse is
for).
Andrew
"Biep @ http://www.biep.org/" wrote:
>
> On a related note, what would people think of OZ as a beginners' language?
> (http://www.mozart-oz.org) Is it used anywhere as such?
>
> --
> Biep
> Reply via http://www.biep.org
------------------------------
Date: Thu, 10 May 2001 10:06:33 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Pattern matching using variable ...
Message-Id: <sppkfts09i3b7u1vbgal6hbbj14vd0oitm@4ax.com>
Vishwanath Sen wrote:
>$pattern = "abc";
>
>if ($tmp1 =~ /$pattern/) {
> print "match found \n";
>}
>
>Basically in the pattern matching if condition I want to use pattern
>defined in $pattern. So what will that if condition look like ?
That's it.
Also check out the /o option, if $pattern won't ever change during the
life of the script. It might speed up the match a bit.
But I think that recent versions of perl have a bit of an optimizer
built in, so that it doesn't recompile the regex if the scalar hasn't
changed, so the time difference with or without /o needn't be that big
any more.
Oh, and the *contents* of $pattern should look like what you'd enter in
a normal regex. That needn't be the same as what you enter in the
string. For example, in order to match a backslash, you need two
backslashes in the pattern:
/\\/
but in order to get two backslashes into a string, you generally need 4
backslashes:
$pattern = '\\\\';
print $pattern; # --> \\
/$pattern/; # matches a backslash
--
Bart.
------------------------------
Date: 10 May 2001 10:50:06 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Pattern matching using variable ...
Message-Id: <9ddrou$hclgu$2@fu-berlin.de>
Bart Lateur <bart.lateur@skynet.be> wrote:
> Vishwanath Sen wrote:
>>$pattern = "abc";
>>
>>if ($tmp1 =~ /$pattern/) {
>> print "match found \n";
>>}
> Oh, and the *contents* of $pattern should look like what you'd enter in
> a normal regex. That needn't be the same as what you enter in the
> string. For example, in order to match a backslash, you need two
> backslashes in the pattern:
> /\\/
> but in order to get two backslashes into a string, you generally need 4
> backslashes:
or better, just type
m/\Q$pattern/
perldoc -f quotemeta
regards,
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanx
------------------------------
Date: Thu, 10 May 2001 11:12:06 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Pattern matching using variable ...
Message-Id: <tqtkft0p4m5cl5cb07cb6e862aomensvg3@4ax.com>
Tina Mueller wrote:
>> but in order to get two backslashes into a string, you generally need 4
>> backslashes:
>
>or better, just type
>m/\Q$pattern/
Hey, this guy wants a custom regex, not a literal match!
So let's change the rules for this example: suppose you want to match a
row of literal backalshes. Like this:
/\\+/
Now put the pattern in a scalar, and make it work using '\Q'.
A bare backslash was just a simple example.
--
Bart.
------------------------------
Date: 10 May 2001 12:01:05 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Pattern matching using variable ...
Message-Id: <9ddvu1$hclgu$3@fu-berlin.de>
Bart Lateur <bart.lateur@skynet.be> wrote:
> Tina Mueller wrote:
>>> but in order to get two backslashes into a string, you generally need 4
>>> backslashes:
>>
>>or better, just type
>>m/\Q$pattern/
> Hey, this guy wants a custom regex, not a literal match!
> A bare backslash was just a simple example.
sure =)
and my suggestion was just a simple hint if the OP ever wants
to work with patterns which are more complicated.
regards,
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanx
------------------------------
Date: Thu, 10 May 2001 10:07:03 +0200
From: Christian Meisl <christian.meisl@tugraz.at>
Subject: perldoc-Seiten in Dokument einbinden
Message-Id: <1008351.kT8p0MMh6R@famvtpc59.tu-graz.ac.at>
Ich bin mir jetzt nicht ganz sicher, ob das Topic eher Perl oder eher LaTeX
betrifft, aber ich probier's halt mal in beiden Newsgroups:
Es gibt einen Befehl "pod2latex", der Inline-Dokumentationen von
Perl-Programmen, die mit =pod ... =cut im Programm selbst erstellt wurden,
in LaTeX-Sourcecode umwandelt. Leider generiert dieser Befehl zwar
\index-Eintraege zu jeder \section, aber dafuer keine \label-Eintraege.
Kennt jemand eine Moeglichkeit, wie man pod2latex dazu bringen kann, statt
der \index-Eintraege einfach \label's zu definieren, damit man sich im
Hauptdokument auf die entsprechenden Kapitel beziehen kann?
LG
Christian
--
Christian Meisl
Department for Chemical Apparatus Design, Particle Technology and Combustion
Graz University of Technology
------------------------------
Date: Thu, 10 May 2001 12:03:16 GMT
From: "ivo welch" <nospam@yale.edu>
Subject: pod + vgrind ?
Message-Id: <9de023$nhe$1@news.ycc.yale.edu>
Is there a program that nicely formats perl code (preferably to postscript),
similar to vgrind on Unix systems, and which also knows about (and
properly prints) pod directives?
/iaw
------------------------------
Date: 10 May 2001 11:26:13 GMT
From: "nutcracker" <nutcracker@no-spam.org>
Subject: Re: problem with perlapp (PDK 2.1)
Message-Id: <9ddtsl$42a@dispatch.concentric.net>
windows 2000 Professional.
thanks
"Wyzelli" <wyzelli@yahoo.com> wrote in message
news:8aqK6.15$Dp.2591@vic.nntp.telstra.net...
> "nutcracker" <nutcracker@no-spam.org> wrote in message
> news:9dd8kb$416@dispatch.concentric.net...
> > Hello Everyone,
> >
> > I have a particulary annoying problem. I am unable to get perlapp to
> create
> > a usable, freestanding exe from a rather simple perl script. When I
issue
> my
> > build command, it just sits there, with perlapp hoggin the
> > processor...forever.
> >
> > When running the command:
> >
> > perlapp -v script.pl -f
> >
> > I should end up with script.exe, and I do. Sometimes it is 24k in size,
> > others it is 117k. Neither will run on a system that does not have perl
> > installed on it, as it complains that perlapp.dll cannot be loaded.
> >
> > I have tried everything that I can think of. I have even specified it as
> > a -b[ind]=<list> arguement.
> >
> > I really need this to work. Does anyone have any ideas?
> >
> > I have activestate 5.6.1.626 installed, and PDK 2.1. Both licensed.
>
> Perhaps a look at the script in question would be helpful, and What OS are
> you on?
>
> Wyzelli
> --
> ($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
> around');
> $d='$_$a$s$b$w';$e='$_$a$s$b';sub
d{$h=shift;$h=~s/\$(\w+)/${$1}/g;return$h}
> sub
> e{return(shift!=1)?'s':''}for(reverse(1..100)){$s=e($_);$f=d($d);$g=d($e);
> $c.="$f\n$g\n$t\n";$_--;$s=e($_);$e=d($d);$c.="$e\n\n";}print"$c*hic*";
>
>
------------------------------
Date: Thu, 10 May 2001 21:50:19 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: problem with perlapp (PDK 2.1)
Message-Id: <FBvK6.7$vu.1912@vic.nntp.telstra.net>
"nutcracker" <nutcracker@no-spam.org> wrote in message
news:9ddtsl$42a@dispatch.concentric.net...
> windows 2000 Professional.
>
> > > When running the command:
> > >
> > > perlapp -v script.pl -f
Looks Ok... How about the script?
Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';
------------------------------
Date: 10 May 2001 12:18:50 GMT
From: "nutcracker" <nutcracker@no-spam.org>
Subject: Re: problem with perlapp (PDK 2.1)
Message-Id: <9de0va$cfo@dispatch.concentric.net>
I will have to post that here later....unless you want to take this to email
(which would be better at the moment, as I cannot access this news server
from work)
thayward at dnsplus dot net
thanks
"Wyzelli" <wyzelli@yahoo.com> wrote in message
news:FBvK6.7$vu.1912@vic.nntp.telstra.net...
> "nutcracker" <nutcracker@no-spam.org> wrote in message
> news:9ddtsl$42a@dispatch.concentric.net...
> > windows 2000 Professional.
> >
> > > > When running the command:
> > > >
> > > > perlapp -v script.pl -f
>
> Looks Ok... How about the script?
>
> Wyzelli
> --
> #Modified from the original by Jim Menard
> for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
> wall,\n";
> print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
> $_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
> wall\n\n";}print'*burp*';
>
>
>
------------------------------
Date: Thu, 10 May 2001 17:57:16 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: Question about "->" operator
Message-Id: <CDrK6.23472$482.111130@newsfeeds.bigpond.com>
"Randal L. Schwartz" <merlyn@stonehenge.com> wrote in message
news:m1k83q4o21.fsf@halfdome.holdit.com...
<snip>
> "perldoc perlref" =>
>
> 3. Subroutine calls and lookups of individual array
> elements arise often enough that it gets cumbersome to
> use method 2. As a form of syntactic sugar, the
> examples for method 2 may be written:
>
> $arrayref->[0] = "January"; # Array element
> $hashref->{"KEY"} = "VALUE"; # Hash element
> $coderef->(1,2,3); # Subroutine call
>
> That's your one, that last one right there. Invented by me on a dare
> that I couldn't get Chip Salzenberg, the 5.004 pumpking, to add at
> least one significant feature to Perl during the *gamma* release
> phase. I won. :)
>
> Prior to that, you had to use the other kind of dereferencing:
>
> &{$coderef}(@args)
>
> This cleaned it up to:
>
> $coderef->(@args)
>
> and 5.6 allows you to drop the arrow in some places as well. Chip
> couldn't do that without breaking something else; I'm not sure what
> changed to permit that.
>
> print "Just another Perl hacker,"
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!
A very useful invention indeed!!
It make possible the 'apply' function which we were discussing in this forum
a few weeks ago:
sub apply (&$) {
local $_ = $_[1];
$_[0]->();
$_;
}
gtoomey
------------------------------
Date: 10 May 2001 11:25:07 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Reading from empty file handle OR from a pipe
Message-Id: <9ddtqj$qlp$3@mamenchi.zrz.TU-Berlin.DE>
According to Mark Jason Dominus <mjd@plover.com>:
> In article <7qfr8xyofsg.fsf@demchh2msx.icn.siemens.de>,
> Ronald Fischer <ronald.fischer@deadspam.com> wrote:
> >Depending on some switch (say), my program should sometimes do this:
> >
> > while(<>)
> > {
> > ... process every line from the arguments or stdin
> > }
> >
> >and sometimes do this:
> >
> > open(X,"myfilter|");
> > while(<X>)
> > {
> > ... process every line coming from my filter
> > }
>
> How about:
>
> if ($flag) { @ARGV = "myfilter|" }
> while (<>) {
> ... process every line from the arguments or stdin or myfilter
> }
>
> That seems easier than anything else anyone mentioned so far.
You're right. For some reason I was under the impression the
alternative to ARGV was a socket. In that case you'd want an
explicit open.
Anno
------------------------------
Date: Thu, 10 May 2001 17:19:57 +0800
From: Murlimanohar Ravi <eng80956@nus.edu.sg>
Subject: thank you!
Message-Id: <191C91BDFE8ED411B84400805FBE794C0FB6D9A6@pfs21.ex.nus.edu.sg>
thanks a LOT! you just made my day! :-)
cheers,
murli
-----Original Message-----
From: uri@home.sysarch.com
Posted At: 5/10/01 4:12 PM
Conversation: extracting filenames
Subject: Re: extracting filenames
>>>>> "MR" == Murlimanohar Ravi <eng80956@nus.edu.sg> writes:
MR> how do i extract the names of all the files present in a
MR> particular directory? i know how many files are present in the
MR> directory so is there some way to use a while/for construct to
MR> read each file's name and return them one by one?
opendir and readdir are your friends.
uri
--
Uri Guttman --------- uri@sysarch.com ----------
http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------
http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July
10-11
Class and Registration info:
http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: Thu, 10 May 2001 06:05:53 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: weird error on @array syntax
Message-Id: <3AFA9231.26CDCB58@stomp.stomp.tokyo>
Mark Jason Dominus wrote:
> Craig Berry <cberry@cinenet.net> wrote:
> >: In string, @a now must be written as \@a at ..
> >I understand this will be downgraded to a warning in some future version.
(unnoted snippage by Dominus, context deliberately changed)
> Current version.
> % perl5.6.1 -e 'print "@a"'
> % perl5.6.1 -we 'print "@a"'
> Possible unintended interpolation of @a in string at -e line 1.
> > In brief, the Perl compiler cannot, at compiler time, see any other
> > reference to @a anywhere in your program, so it leaps to the conclusion
> > that you are trying to write a literal '@' rather than trying to
> > interpolate @a.
> Wrong. Perl never does this. @ in a string is *always* interpreted
> as an array interpolation, since version 5.000.
> See
> http://perl.plover.com/at-error.html
> for complete details.
Your linked explanation is unrelated to this odd glitch
evidenced by various sample codes provided.
Personally, I am sticking with Berry on this one for
three good reasons; he is knowledgeable, he makes good
sense and he is polite. My latter reason being of
greatest importance.
Godzilla!
------------------------------
Date: Thu, 10 May 2001 11:53:05 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: Win32::ODBC hangs unless I run with "-d"
Message-Id: <3afa7968.80632984@news.grnet.gr>
On Tue, 8 May 2001 06:46:32 -0700, "Toni Vatcher"
<tmvatcher@Xbigfoot.com> wrote:
>"Philip Lees" <pjlees@ics.forthcomingevents.gr> wrote in message
>news:3af78dc8.61999780@news.grnet.gr...
>> On Mon, 7 May 2001 14:38:03 -0700, "Toni Vatcher"
>> <tmvatcher@Xbigfoot.com> wrote:
>>
>> I asked about this last September in a thread with subject 'Warning
>> message in Win32::ODBC module'. You can look it up if you're
>> interested.
>
>I looked at the thread. It looks like the error you saw was occurring in
>GetData. I'm hanging in "New". There is a call to ODBCConnect (which I'm
>guessing is in ODBC.dll since I couldn't find it in ODBC.pm) and that's
>what's hanging.
>
>I appreciate your help. Let me know if you have other suggestions.
My problem was definitely related to warnings arising in a CGI script
under Win 2K. Same symptoms, worked fine in debug mode. Could your dll
be corrupt?
I'd be interested to learn if you find out what your problem is due
to, before I hit it myself :-)
Philip
--
Philip Lees
ICS-FORTH, Heraklion, Crete, Greece
Ignore coming events if you wish to send me e-mail
'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer
------------------------------
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 868
**************************************