[8851] in Perl-Users-Digest
Perl-Users Digest, Issue: 2468 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 30 20:05:08 1998
Date: Thu, 30 Apr 98 17:00:26 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 30 Apr 1998 Volume: 8 Number: 2468
Today's topics:
Confusion with new warning concerning split operator in (Alex Blume)
Re: Confusion with new warning concerning split operato (Tad McClellan)
deroff error from PERL??? <ils@ils.xo.com>
Executing a pattern match? ie $_-~s/<(\d+)>/system(/bin <neal@make-a-store.com>
Re: Executing a pattern match? ie $_-~s/<(\d+)>/system( <rootbeer@teleport.com>
Re: Executing a pattern match? <brianm@kodak.com>
Re: Executing a pattern match? <brianm@kodak.com>
Fork/Filehandle Wierdness <davidl@inkttomi.com>
Re: How do I format the space in a print statement? <brianm@kodak.com>
Re: How do I format the space in a print statement? <rootbeer@teleport.com>
Re: How do I format the space in a print statement? (Kevin Reid)
Re: How do I format the space in a print statement? <johnnie@holly.colostate.edu>
Re: How to read command line literally? (Richard Bellavance)
Re: Looking for an idiom (cf. Schwartzian Transform) (John Porter)
Re: Looking for an idiom (cf. Schwartzian Transform) <danboo@negia.net>
Re: Looking for an idiom (cf. Schwartzian Transform) <danboo@negia.net>
Re: multiple commands at a time? <johnnie@holly.colostate.edu>
Re: Newbie: How do you compile a script in Perl for Win rpearce@fastlane.net
Re: Perl Editor?? (Patrick)
Re: Perl Editor?? (Earl Hood)
Re: Perl loops have me stumped for pagenumbering sequen <wkolln@cia.com.au>
Re: Perl loops have me stumped for pagenumbering sequen <rootbeer@teleport.com>
Re: Perl/Wall lingo question (John Porter)
Re:Win32 & Process listing. <perl@corcoll.demon.co.uk>
Re: Splitting a variable ??? <terjekv@ifi.uio.no>
Sybperl <LPHAM@prodigy.net>
Win32::NetResource::AddConnection exhibiting undocument (Jonathan Stowe)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 30 Apr 1998 22:24:35 GMT
From: ablume@80s.com (Alex Blume)
Subject: Confusion with new warning concerning split operator in perl5.004
Message-Id: <3548f7eb.10426307@news.metropolis.com>
Under perl 5.004_04, the following code,
#!/usr/local/bin/perl
$test_string = "3-4-5-6";
$dash_count = split(/\-/, $test_string);
print "String $test_string has $dash_count dashes\n";
exit(0);
now generates the warning
Use of implicit split to @_ is deprecated at test.pl line 3.
Could anyone explain this error message to me, and whether there is a
better method to count the number of regular expression matches (in
this case, just dashes) found in a string.
------------------------------
Date: Thu, 30 Apr 1998 18:10:54 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Confusion with new warning concerning split operator in perl5.004
Message-Id: <ud0bi6.s64.ln@localhost>
Alex Blume (ablume@80s.com) wrote:
: Under perl 5.004_04, the following code,
: #!/usr/local/bin/perl
: $test_string = "3-4-5-6";
: $dash_count = split(/\-/, $test_string);
: print "String $test_string has $dash_count dashes\n";
: exit(0);
: now generates the warning
: Use of implicit split to @_ is deprecated at test.pl line 3.
: Could anyone explain this error message to me,
There are files already installed on your HD that can help explain
it. These are often referred to as "man pages" hereabouts, but
they may be in HTML or POD or some other format on your system.
The man pages are *included with the perl distribution*.
If you have perl, then you have these somewhere. Please find out
where they are on your system. It will save you *loads* of time
to find the answer in 30 seconds rather than posting and waiting
hours/days/forever...
The 'perldiag' man page lists all of the error messages that perl
might issue:
--------------------------
=item Use of implicit split to @_ is deprecated
(D) It makes a lot of work for the compiler when you clobber a
subroutine's argument list, so it's better if you assign the results of
a split() explicitly to an array (or list).
--------------------------
So your split above is putting the split items into @_, then counting
them, then throwing away the array that it just loaded up.
Rather wasteful, and there are Better Ways of doing it.
: and whether there is a
: better method to count the number of regular expression matches (in
: this case, just dashes) found in a string.
You mean like the ways that are given in yet another file that
you already have?
Some of the man page files contain the Perl Frequently Asked Question
(FAQ) list. You should ALWAYS check for your question there before
posting it. Else everybody will think you are lazy and rude, which
will likely have an effect on their inclination to help or to
ignore you ;-)
Please check the FAQ in the future before asking a FAQ yet again.
'perlfaq4 has your Frequently Asked Question in it:
"How can I count the number of occurrences of a
substring within a string?"
Where it give two other ways. Both much better than what you have tried.
Go have a look at them.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 30 Apr 1998 14:24:19 -0700
From: "ils@ils.xo.com" <ils@ils.xo.com>
Subject: deroff error from PERL???
Message-Id: <3548EC03.7547@ils.xo.com>
Midway through a large job, my perlscript burped out a few messages
stating:
Deroff: cannot open file xxx
where xxx was some weird string, sometimes with odd characters like the
British pound sign. What is the cause of this? any help?
------------------------------
Date: Thu, 30 Apr 1998 17:25:18 -0400
From: Neal Kaiser <neal@make-a-store.com>
Subject: Executing a pattern match? ie $_-~s/<(\d+)>/system(/bin/myprog $1)/g;
Message-Id: <3548EC3D.F085B4A3@make-a-store.com>
This may seem a little strange...but I want to do the following:
Read in a line, replace the occurance of a certain string with the
output of a program passing in the pattern match as a parameter.
ie
$str = "blah blah <1> blah blah <2> blah blah";
I want to do something like:
$str=~s/<(\d+)>/system(/bin/myprog $1)/g;
Any way to do this??
Thanks in advance...
------------------------------
Date: Thu, 30 Apr 1998 21:50:37 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Neal Kaiser <neal@make-a-store.com>
Subject: Re: Executing a pattern match? ie $_-~s/<(\d+)>/system(/bin/myprog $1)/g;
Message-Id: <Pine.GSO.3.96.980430145010.8307b-100000@user2.teleport.com>
On Thu, 30 Apr 1998, Neal Kaiser wrote:
> I want to do something like:
> $str=~s/<(\d+)>/system(/bin/myprog $1)/g;
I think you want the /e option to s///, documented in perlop. Hope this
helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 30 Apr 1998 17:34:16 -0400
From: Brian Mathis <brianm@kodak.com>
To: neal@make-a-store.com
Subject: Re: Executing a pattern match?
Message-Id: <3548EE58.CF6C3F69@kodak.com>
Neal Kaiser wrote:
>
> This may seem a little strange...but I want to do the following:
> Read in a line, replace the occurance of a certain string with the
> output of a program passing in the pattern match as a parameter.
> ie
> $str = "blah blah <1> blah blah <2> blah blah";
> I want to do something like:
> $str=~s/<(\d+)>/system(/bin/myprog $1)/g;
>
> Any way to do this??
>
> Thanks in advance...
No problem. First, you need to break it up into multiple steps:
$str = 'blah';
$replace = `/bin/myprog $1`;
$str =~ s/la/$replace/g;
You need to use backticks(``) to let you capture the output of the
program you run. You can't do it inside the s///, because it will try
to interpret the replace string literally, but you can use a variable,
as I have done.
Brian Mathis
------------------------------
Date: Thu, 30 Apr 1998 17:57:37 -0400
From: Brian Mathis <brianm@kodak.com>
Subject: Re: Executing a pattern match?
Message-Id: <3548F3D1.B35D476A@kodak.com>
Brian Mathis wrote:
Forget my answer, I was stupid.
------------------------------
Date: Thu, 30 Apr 1998 15:51:53 -0700
From: David Leavenworth <davidl@inkttomi.com>
Subject: Fork/Filehandle Wierdness
Message-Id: <35490088.F85FBCDC@inkttomi.com>
If I open a file, fork, and exit the child, the parent's copy
of the filehandle gets messed up in a way that prevents me from
ever finding the end of the file.
I checked the FAQ (briefly) and found nothing. Hopefully one of
knowledgeable people will be able to point me in the right direction.
The offending snippet follows. Give it the filename of some text
file as a command line arg.
If you run it as it is, it will fail as described above: it never
finds the end of the file but instead endlessly loops through the
file.
If you comment out the forking and child stuff, the script does work
as I would expect: it prints out lines of a file exiting at the end
of the file.
Is this a documented perl bug? Or is it just me?! :) I've tried it on
LINUX and Solaris, 5.004_04 built for i386-linux and 5.003_02,
respectively.
Thanks!
--
Dave (L)
--------------------------- CUT HERE -----------------------------
#!/usr/local/bin/perl
open(QUERIES,"$ARGV[0]") or die "Can't read $ARGV[0]: $!";
while ( 1 ) {
$pid = fork();
if($pid > 0) {
$it = &get_query_words();
} else {
exit 0;
}
waitpid $pid, 0;
}
exit 0;
sub get_query_words {
local($new);
$new = <QUERIES>;
if (! defined $new ) { print "EOF\n"; exit }
chomp($new);
print "$new\n";
return $new;
}
------------------------------
Date: Thu, 30 Apr 1998 16:58:59 -0400
From: Brian Mathis <brianm@kodak.com>
To: Bryan T Hoch <bth@acsu.buffalo.edu>
Subject: Re: How do I format the space in a print statement?
Message-Id: <3548E613.F7B24526@kodak.com>
Bryan T Hoch wrote:
>
> Hi.
> I'm trying to specificy the length a print out that I'm working on. I want
> to specify how long I want the printed statements should be, but am
> unsure how.
> An example migh clear up what I am talking about.
>
> Ex.
> I want to print 12 characters (white space or other), so if I only had 6
> characters I would need 6 more of white space to be used as filler...
>
[...]
> Anyone know how to do this?
> Anyone even know what I'm talking about?
> Thanks in advance.
> Bryan H
Take a look at the 'format()' and 'write()' functions. They provide the
functionality you are looking for.
perldoc -tf format
perldoc -tf write
Brian Mathis
------------------------------
Date: Thu, 30 Apr 1998 21:07:36 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Bryan T Hoch <bth@acsu.buffalo.edu>
Subject: Re: How do I format the space in a print statement?
Message-Id: <Pine.GSO.3.96.980430140710.8307Z-100000@user2.teleport.com>
On Thu, 30 Apr 1998, Bryan T Hoch wrote:
> I'm trying to specificy the length a print out that I'm working on.
You may want printf, or you may want pack. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 30 Apr 1998 18:04:07 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: How do I format the space in a print statement?
Message-Id: <1d8b5tm.127bjke2mjbyhN@slip166-72-108-172.ny.us.ibm.net>
Bryan T Hoch <bth@acsu.buffalo.edu> wrote:
> Hi.
> I'm trying to specificy the length a print out that I'm working on. I want
> to specify how long I want the printed statements should be, but am
> unsure how.
> An example migh clear up what I am talking about.
>
> Ex.
> I want to print 12 characters (white space or other), so if I only had 6
> characters I would need 6 more of white space to be used as filler...
>
> print "hello.";
> print "<----";
>
> would be
>
> hello. <----
The printf function will do what you want.
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Thu, 30 Apr 1998 16:55:40 -0600
From: John Blanco <johnnie@holly.colostate.edu>
To: Bryan T Hoch <bth@acsu.buffalo.edu>
Subject: Re: How do I format the space in a print statement?
Message-Id: <3549016B.13095B86@holly.colostate.edu>
Bryan T Hoch wrote:
> I want to print 12 characters (white space or other), so if I only had
> 6
> characters I would need 6 more of white space to be used as filler...
You want:
printf "%-12s", $var;
- Johnnie B
------------------------------
Date: 30 Apr 1998 16:46:51 -0400
From: charlot@CAM.ORG (Richard Bellavance)
Subject: Re: How to read command line literally?
Message-Id: <6ianvr$m3r@stratus.CAM.ORG>
In article <893888931.412211@cabal>,
? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> wrote:
>
>I decided that dos globbing was broken when I found that "type *.txt"
>didn't work. There was no good reson for this.
>
How about "ren *.htm *.html" ??? The first "*" is globbed, but not the 2nd
one...
Richard.
--
Richard Bellavance |
| "Rien n'est plus imminent que l'impossible."
charlot@cam.org | - Victor Hugo
http://www.cam.org/~charlot/ |
------------------------------
Date: Thu, 30 Apr 1998 22:07:13 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Looking for an idiom (cf. Schwartzian Transform)
Message-Id: <MPG.fb2c1a7650177d6989688@news.min.net>
On 30 Apr 1998 19:32:38 GMT,
in article <slrn6khkem.iui.mgm@unpkhswm04.bscc.bls.com>,
mgm@unpkhswm04.bscc.bls.com (Mitchell Morris) wrote:
> In short, I wanted to sort a list where the key words were an optional
> number followed by an alpha word, e.g. Foo, 0Foo, 1Foo, Bar, 0Bar, 1Bar, etc.
> I of course wanted all the "Foo" words to sort together, and all in numeric
> sequence amongst themselves. My first try, which doesn't work, was:
>
> map { $_->[0] } sort { $a->[1] cmp $b->[1] }
> map { [ $_, s/(\d+)(\D+)/$2$1/ ] } @lines;
>
> The difficulty is that s/// returns the number of substitutions performed,
> and what I want is the resulting string. Is there a perl idiom that I
> could substitute here so the map will work the way I want it to?
In addition to Tom P's solution, may I suggest the following
for further study.
map { $_->[0] }
sort {
$a->[1] cmp $b->[1]
or
$a->[2] <=> $b->[2]
}
map {
/^(\d+)(\D+)/;
[ $_, $2, $1 ]
} @lines;
John Porter
------------------------------
Date: Thu, 30 Apr 1998 18:34:47 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Looking for an idiom (cf. Schwartzian Transform)
Message-Id: <3548FC87.C49238CF@negia.net>
John Porter wrote:
>
> On 30 Apr 1998 19:32:38 GMT,
> in article <slrn6khkem.iui.mgm@unpkhswm04.bscc.bls.com>,
> mgm@unpkhswm04.bscc.bls.com (Mitchell Morris) wrote:
> > In short, I wanted to sort a list where the key words were an optional
^^^^^^^^
> > number followed by an alpha word, e.g. Foo, 0Foo, 1Foo, Bar, 0Bar, 1Bar, etc.
this fails if there is no leading digit. i believe changing the regex
to /^(\d*)(\D+)/ should do the trick. i would also change the third
element of the anonynmous array to $1 || 0, just to stop the warnings
under -w.
>
> map { $_->[0] }
> sort {
> $a->[1] cmp $b->[1]
> or
> $a->[2] <=> $b->[2]
> }
> map {
> /^(\d+)(\D+)/;
> [ $_, $2, $1 ]
> } @lines;
--
Dan Boorstein home: danboo@negia.net work: danboo@y-dna.com
"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
- Cosmic AC
------------------------------
Date: Thu, 30 Apr 1998 17:10:40 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Looking for an idiom (cf. Schwartzian Transform)
Message-Id: <3548E8D0.EA3B6539@negia.net>
Mitchell Morris wrote:
[SNIP]
> In short, I wanted to sort a list where the key words were an optional
> number followed by an alpha word, e.g. Foo, 0Foo, 1Foo, Bar, 0Bar, 1Bar, etc.
> I of course wanted all the "Foo" words to sort together, and all in numeric
> sequence amongst themselves. My first try, which doesn't work, was:
>
> map { $_->[0] } sort { $a->[1] cmp $b->[1] }
> map { [ $_, s/(\d+)(\D+)/$2$1/ ] } @lines;
>
> The difficulty is that s/// returns the number of substitutions performed,
> and what I want is the resulting string. Is there a perl idiom that I
> could substitute here so the map will work the way I want it to?
one thing to remember is that after map you have a block and can do more
than just one statement. in the version below i actually pass a 3
element array reference into the sort instead of 2. first is the
origninal value, then the word characters, and finally the optional
digits, which i set to 0 if it is undefined. this is simply to silence
the warnings about the argument to sort not being numeric.
the reason i break things into 2 peices as opposed to just rearranging,
is so a secondary _numeric_ sort can be performed on the digit. the
direction you were heading in would have sorted '23Foo' before '3Foo'.
perhaps this is what you wanted. take a look at the documentation on
'sort' for more info on cascading sorts.
@bits = qw(Foo 0Foo 1Foo Bar 0Bar 1Bar 2Bar 12Bar 13Bar Foo);
print map { $_->[0], "\n" }
sort { $a->[1] cmp $b->[1] or $a->[2] <=> $b->[2] }
map { m/(\d*)(\D+)/; [ $_, $2, $1 || 0 ] }
@bits;
if you _did_ want to sort simply on the characters then you could do:
print map { $_->[0], "\n" }
sort { $a->[1] cmp $b->[1] }
map { m/(\d*)(\D+)/; [ $_, $2.$1 ] }
@bits;
hope this helps,
--
Dan Boorstein home: danboo@negia.net work: danboo@y-dna.com
"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
- Cosmic AC
------------------------------
Date: Thu, 30 Apr 1998 16:51:58 -0600
From: John Blanco <johnnie@holly.colostate.edu>
To: Philipp <Philipp999@gmx.net>
Subject: Re: multiple commands at a time?
Message-Id: <3549008E.C3013F0D@holly.colostate.edu>
Philipp wrote:
> I am trying to run multiple 'whois' commands at a time.
Check out the fork-wait commands.
- Johnnie B
------------------------------
Date: Thu, 30 Apr 1998 16:36:17 -0600
From: rpearce@fastlane.net
Subject: Re: Newbie: How do you compile a script in Perl for Win32?????
Message-Id: <6iaqsh$p2s$1@nnrp1.dejanews.com>
Jon,
Be warned. You're probably going to get bombed with notices to "Read the
FAQ". Some will be nice, but some (one in particular) will probably make some
pretty snotty remarks.
To save time read "The Idiot's Guide to Solving Perl CGI Problems" at
http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html
You'll probably find your answers in the first few lines.
Don't worry about the flames. Probably a case of poor self-esteem.
Rick...
In article <co121.994$v74.1476107@katana>,
"Jonathan Burns" <JonathanBurns@onlineinfoservices.com> wrote:
>
> I have a .pl file, but when I access it from the web, it displays the script
> as if it were a text file. Does it need to be compiled? How do you compile
> it with Perl for Win32?
>
> Thanks,
>
> Jon Burns
> JBurns@onlineinfoservices.com
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 30 Apr 1998 21:26:57 GMT
From: patrickq@autobahn.mb.ca (Patrick)
Subject: Re: Perl Editor??
Message-Id: <3548e921.3274094@news.autobahn.mb.ca>
vim (ver 5.*) can be built so perl can be called directly from the
command line! (makes it a rather large executable tho)
:perl {cmd} Execute Perl command {cmd}. {not in Vi}
:[range]perldo {cmd} Execute Perl command {cmd} for each line in the
[range] (default whole file). {not in Vi}
http://www.vim.org
Patrick
__________
"It's better to have loved and lost than to never have seen Lost in Space"
-- Kelly Bundy quoting Chinese philosopher Unconcious
------------------------------
Date: 30 Apr 1998 22:36:27 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: Perl Editor??
Message-Id: <6iaudb$rip@news.service.uci.edu>
In article <3548e921.3274094@news.autobahn.mb.ca>,
Patrick <patrickq@autobahn.mb.ca> wrote:
>vim (ver 5.*) can be built so perl can be called directly from the
>command line! (makes it a rather large executable tho)
The size can reduced if Perl was compiled with the shared library
option. This way other application can link against a shared
library instead of a static library.
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: Fri, 01 May 1998 08:30:16 +1000
From: William Kolln <wkolln@cia.com.au>
Subject: Re: Perl loops have me stumped for pagenumbering sequence!!
Message-Id: <3548FB78.49984A60@cia.com.au>
Hi
I posted this enquiry on 24/4 but perhaps my posting was too complex.
Here is a
simplified version.
$count=5;
@pagenumber=(1..$count);
@pagestart=(20 21 30 35 40 45 50 77 98 100);
$itembegin = (@pagestart[0]);
1. print "<a href=\"$itembegin\">$itembegin</a>\n";
foreach $itemid(@pagestart[2,4,6,8,10]) {
2. print "<a href=\"$itemid\"> $itemid\n";
}
line 1. produces the number 20 for $itembegin.
line 2. produces the numbers 21 35 45 77 100 foreach $itemid
What I would like this to do, is replace the 2nd $itemid
in line 2. with the consecutive numbers 1..5
but still be referenced in the anchor as $itemid.
Is there any way this can be done? I have tried
many combinations of loop statements, splitting, grep ing and even
splitting line 2.,
and have searched through CPAN and several books for
different examples of looping and arrays, but after 2 weeks of trying
I am at a loss about where to turn next.
As always you time is greatly appreciated....if you are unable to
assist,
but at least know where there is an example of a pagenumbering sequence
available in the public domain, your advice will be greatly appreciated.
Cheers
William
------------------------------
Date: Thu, 30 Apr 1998 23:56:04 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: William Kolln <wkolln@cia.com.au>
Subject: Re: Perl loops have me stumped for pagenumbering sequence!!
Message-Id: <Pine.GSO.3.96.980430164331.8307d-100000@user2.teleport.com>
On Fri, 1 May 1998, William Kolln wrote:
> $count=5;
> @pagenumber=(1..$count);
> @pagestart=(20 21 30 35 40 45 50 77 98 100);
>
> $itembegin = (@pagestart[0]);
If you ask perl for warnings (with the -w invocation option; see
perlrun) perl will remind you that you shouldn't use @array[0] when you
mean $array[0]. What you have there is a slice, which is not the same as
an array element access.
> 1. print "<a href=\"$itembegin\">$itembegin</a>\n";
> foreach $itemid(@pagestart[2,4,6,8,10]) {
There you _do_ have a slice. But you're using index 10, and you have only
10 elements in @pagestart. Maybe you meant @pagestart[1,3,5,7,9] ?
> 2. print "<a href=\"$itemid\"> $itemid\n";
> }
>
> line 1. produces the number 20 for $itembegin.
Right, that's what's in $itembegin.
> line 2. produces the numbers 21 35 45 77 100 foreach $itemid
That's not right, not with the code you're showing. That's what it would
produce if you used the indicies I suggested, though.
> What I would like this to do, is replace the 2nd $itemid
> in line 2. with the consecutive numbers 1..5
> but still be referenced in the anchor as $itemid.
That's not clear. Are you wanting to store five numbers into one scalar?
That's not possible. (But you could do something with references, if
that's what you mean.) Maybe you want to have an if structure within your
loop, starting an inner loop on those five numbers at the right time.
Maybe you mean that you want line 2 to print something different, but if
that's what you want, what's stopping you? :-)
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 30 Apr 1998 22:00:41 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Perl/Wall lingo question
Message-Id: <MPG.fb2c01f78b27b6b989687@news.min.net>
On Thu, 30 Apr 1998 14:49:24 -0400,
in article <comdog-ya02408000R3004981449240001@news.panix.com>,
comdog@computerdog.com (brian d foy) wrote:
> In article <MPG.fb288b97050d7c0989683@news.min.net>, jdporter@min.net (John Porter) posted:
>
> >... a one-dimensional vector is certainly
> >legit, and is different from a scalar, which is dimensionless.
>
> a one-dimensional vector, and a scalar having a dimension aren't
> mutually exclusive.
What do you mean, "mutually exclusive"? They're different beasts.
The semantics are clearly distinct.
> let's remember why the vector is one-dimensional -
> it holds one scalar.
And a two-dimensional vector "holds" two scalars -- so what?
A scalar is dimensionless, by definition.
> but perhaps this is semantics - the definition of "dimension" differing
> between physics, math, computer science, and perl.
Well, may be, but not by much. A one-dimensional vector is not identical
to a scalar in any of these semantic systems.
John Porter
------------------------------
Date: Thu, 30 Apr 1998 13:07:45 +0100
From: perl <perl@corcoll.demon.co.uk>
Subject: Re:Win32 & Process listing.
Message-Id: <C455575623CED111941500409520680E010438@BETTY>
Try checking out the NT Resources Kit a program called Plist should
help. assuming you are working with NT and not with Win9x that is
> -----Original Message-----
> From: Gorm Haug Eriksen [SMTP:xxxgormxxx@p4.no]
> Posted At: Friday, April 24, 1998 1:47 PM
> Posted To: misc
> Conversation: Win32 & Process listing
> Subject: Win32 & Process listing
>
>
> hi,
>
> Someone know a way to list processes running on a Windows NT box?
>
> Seems like a pain in the a** according to the fact that this is not
> listed in any faqs I have seen, and not described in any Win32 docs I
> have looked at...?
>
> Cheers,
>
> --
> Gorm
>
> WARNING: By removing all the x's in my emailaddress, you also
> confirm that you will not use it for commercial advertising.
------------------------------
Date: 30 Apr 1998 23:25:13 +0200
From: Terje Kvernes <terjekv@ifi.uio.no>
Subject: Re: Splitting a variable ???
Message-Id: <wxxhg3brohy.fsf@hridil.ifi.uio.no>
"Larry Rosler" <lr@hpl.hp.com> writes:
> Martien Verbruggen wrote in message
> <6i5p9v$lck$2@comdyn.comdyn.com.au>...
[...]
> Because \d\d is a bit faster! :)
>
> #!/usr/local/bin/perl -w
> use strict;
> use Benchmark;
>
> use vars qw( $string );
> $string = '042498a';
>
> timethese (100000, {
> 'looped' => q{
> my ($a, $b, $c, $d) = $string =~ /(\d{2})(\d{2})(\d{2})(\w)/;
> },
> 'unrolled' => q{
> my ($a, $b, $c, $d) = $string =~ /(\d\d)(\d\d)(\d\d)(\w)/;
> },
> } );
>
> Benchmark: timing 100000 iterations of looped, unrolled...
> looped: 13 secs ( 6.08 usr 0.02 sys = 6.10 cpu)
> unrolled: 13 secs ( 5.70 usr 0.02 sys = 5.72 cpu)
>
> --
> Larry Rosler
> Hewlett-Packard Laboratories
> lr@hpl.hp.com
hm... I'll keep that in mind... Thanks.
=)
--
Terje Kvernes
http://www.stud.ifi.uio.no/~terjekv/
------------------------------
Date: Thu, 30 Apr 1998 18:41:27 -0400
From: "LOI N PHAM" <LPHAM@prodigy.net>
Subject: Sybperl
Message-Id: <6iaupt$3ojc$1@newssvr04-int.news.prodigy.com>
I got Sybperl for NT binary contributed by Davide Ferina from
http://www.mbay.net/~mpeppler/
I copied *.pll files to /Perl/lib/Auto/Sybase, and *.pm to /Perl/Sybase.
and make some script to query some data.
use Sybase::DBlib;
$d = Sybase::DBlib->dblogin("myusername", "mypassword", "MACHINES");
$d->dbuse('my_database);
$d->sql('select field1, field2 from table1 where field1 = 123',
sub { print @_, "\n";});
$d->dbclose;
I gave me the error:
Error: Parse exception.
1) Did I install Sybperl binary correctly? There was no instruction to
install .pm.
2) If I did correctly, what's wrong with my script?
I got Perl5.003 on NT4, Sybase OpenClient 10.0.1.
I really appreciate your help,
Loi
------------------------------
Date: Wed, 29 Apr 1998 18:54:25 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Win32::NetResource::AddConnection exhibiting undocumented behaviour ?
Message-Id: <35476f8d.11770921@news.btinternet.com>
I have a smallish script that for reasons of state runs on (sigh) an
NT machine and connects in turn to series of Netware servers using
Win32::NetResource::AddConnection.
This works fine when run from the command line, however when run under
the schedule service it doesnt.
Thats fine, NT is crap and its nothing to do with Perl agreed.
The query is that AddConnection doesnt fail (return 0), appears to
work but actually hasnt. The connection isnt made and CloseConnection
then returns an error because there isnt one to close.
In all other possible conditions of failure the behaviour is as
expected. If for instance I give it a bad path it fails normally both
at cmd and with at.
Does anyone have an insight into the circumstances under which the
function might do this ? The return value comes from the XS
subroutine so I cant examine the code.
I am beginning to realize that some sins do have their own punishment.
Cheers
/J\
Jonathan Stowe
Some of your questions answered http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 2468
**************************************