[6712] in Perl-Users-Digest
Perl-Users Digest, Issue: 338 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 21 17:07:12 1997
Date: Mon, 21 Apr 97 14:02:20 -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 Mon, 21 Apr 1997 Volume: 8 Number: 338
Today's topics:
Re: Perl return code (Honza Pazdziora)
Re: Perl Shell instead of C Shell <sveerara@cisco.com>
Re: Perl's equivalent to more (Eric D. Friedman)
Re: Problem: hex() and Unsigned vs. Signed <emagnuss@mcd.intel.com>
Re: read string from file <rootbeer@teleport.com>
Re: Request For Help <nyxcu@ny.ubs.com>
Re: To DLL or Not to DLL what is the answer? <dan.evens@hydro.on.ca>
Re: Unix and ease of use (WAS: Who makes more ...) <Brian.Ewins@gssec.bt.co.uk>
Using ADO (OLEDB) from Perl <rtremble@ctissrv1.plt.ford.com>
Re: Who will win? Borland or Microsoft or Programmers? hbaecker@island.net
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 21 Apr 1997 17:02:25 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Perl return code
Message-Id: <adelton.861642145@aisa.fi.muni.cz>
"Walter Boev" <walter.boev@nrc.ca> writes:
> Hi all,
>
> I have a general question on Perl return codes.
>
> How does one trap a perl script return code.
> The perl script is called from a Korn shell script. When
> the perl script finishes it returns an exit code (e.g. exit 7).
> The Korn shell script then continues to run. However depending
> on the exit status returned by the perl script the Korn shell
> script can branch.
>
> Any help would be appreciated.
In Korn shell you check the variable $? (like in Perl). Syntax in
other shells may differ. you specify the return code in Perl using
exit, for example.
Hope this helps.
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: 21 Apr 1997 10:48:59 -0700
From: Sriranga R. Veeraraghavan <sveerara@cisco.com>
Subject: Re: Perl Shell instead of C Shell
Message-Id: <ls3enc4z2pg.fsf@sveerara-ultra.cisco.com>
In article <slrn5la6ff.hnh.Alain.Deckers@nessie.mcc.ac.uk>
Alain.Deckers@man.ac.uk (A. Deckers) writes:
>
> In comp.lang.perl.misc,
> dsonak@us.oracle.com wrote:
> >My default shell is the C shell [ csh ]. I am wondering if I can have a
> >perl shell as my default shell ?
>
> Save this as psh and use it as your default shell:
>
> ---cut here---
> #!/usr/bin/perl -w
>
> print "psh> ";
>
> while (<STDIN>) {
> eval $_;
> print "psh> ";
> }
> __END__
What about this:
#!/usr/local/bin/perl
$p="$0> ";print$p;while(<STDIN>){print$p;eval}
:) ----ranga <sveerara@cisco.com>
------------------------------
Date: 21 Apr 1997 17:57:39 GMT
From: friedman@medusa.acs.uci.edu (Eric D. Friedman)
Subject: Re: Perl's equivalent to more
Message-Id: <5jg9qj$9mm@news.service.uci.edu>
[mailed, posted]
In article <1997Apr11.073925.6304@news.ntrs.com>,
Alejo Balingit <ab20@tntvax.ntrs.com> wrote:
>I am new to perl and would like to know if there is a way that I can see
>STDOUT a page at a time like the "more" command. Thanks in advance.
Is there some reason you can't use more itself?
% perl -e 'print join "\n",(0..100)' | more
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--More--
--
Eric D. Friedman
friedman@uci.edu
------------------------------
Date: Mon, 21 Apr 1997 09:22:41 -0700
From: Eric Magnusson <emagnuss@mcd.intel.com>
To: Eric Magnusson <emagnuss@pcocd2.intel.com>
Subject: Re: Problem: hex() and Unsigned vs. Signed
Message-Id: <335B9451.2781@mcd.intel.com>
I added some new entries in the table showing more inconsistent and
erroneous behavior for
hex() with unsigned numbers. Any help in figuring out this problem or
identifying a
bug fix would be appreciated.
-Eric
# I am porting a large Perl program from version 4 to version 5. I
# have found an arithmetic problem that is fatal in my application. It
# appears in some contexts, that Perl4 is using unsigned integers, and
# Perl5 is using signed integers.
# Is this a reported bug, with a known work around?
# The following table, an entry listed in the +2G column means that
# perl version interpreted the number as an UNsigned integer. -2G means
# that perl version interpreted the number as a SIGNED integer.
#
# In each case I am trying to set bit #31.
#
# 4 = Perl4 (4.0.1.8 pl.36) 5 = Perl5 (5.003 with EMBED)
#----+----+
# +2G| -2G|
#----+----+
$x = hex("80"); # # #
>0( $x << 24 ); # 4 # 5 # <== Why the difference?
#----+----+
$x = hex("80"); # # #
>0( $x * 0x1000000 );# 45 # # <== Why the difference?
#----+----+
>0( hex("80") << 24 ); # 4 # 5 # <== Why the difference?
#----+----+
>0( hex("80") * 0x1000000 );# 4 # 5 # <== Why the difference?
#----+----+
>0( 0x80000000 ); # 45 # #
#----+----+
>0( hex("80000000") ); # 45 # #
#----+----+
>0( 0x80 * 0x1000000 ); # 45 # #
#----+----+
>0( 0x80000000 << 24 ); # # 45 #
#----+----+
>0( 0x80 << 24 ); # # 45 #
#----+----+
sub gt0 {
print "", (0 < $_[0]) ? "Positive\t" : "Negative\t";
}
------------------------------
Date: Mon, 21 Apr 1997 11:27:41 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Hans Suijkerbuijk <Hans.Suijkerbuijk@SD.BE>
Subject: Re: read string from file
Message-Id: <Pine.GSO.3.96.970421112333.917K-100000@kelly.teleport.com>
On Fri, 18 Apr 1997, Hans Suijkerbuijk wrote:
> 1) I have a file from which i want to read a string:
>
> The file A looks like this:
> ---------
> 123apple
> 456tea
> 789ice
> --------
> and i want to read the line which starts for instance with 456.
$line = undef;
while (<IN>) {
if (/^456/) {
$line = $_;
last;
}
}
die "Line was not found" unless defined $line;
> 2) My second question is: I want to generate random numbers with the
> same number of digits. I tried rand[400] (I don't know why i used 400)
> and i get numbers with 16 or 15 char length. Is there a way to force
> Perl to generate numbers of the same length?
I think you want sprintf, to round off to a certain fixed number of
digits, unless your Perl is misconfigured. Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Mon, 21 Apr 1997 14:24:28 -0400
From: Glen Culbertson <nyxcu@ny.ubs.com>
Subject: Re: Request For Help
Message-Id: <335BB0DC.586EAEC@ny.ubs.com>
Michael Shannon wrote:
>
You need to introduce youself to the beauty of multidimensional hashes.
One approach: Instead of this:
>
> $count{$hh,$boxtype,$carrier}++;
do this:
$count{$hh}{$carrier}{$boxtype}++;
# Although you can always accumulate summary numbers on output,
# I find it is usually easier to accumulate some redundant totals
as I go; e.g.:
$count{$hh}{ZZZZTotal}{$boxtype}++;
# The 'ZZZZ' will make this sort at the bottom of the carriers,
# unless you have a very peculiar carrier.
# And then I would accumulate a grand total:
$count{25}{Total}{$boxtype}++; # This works unless you have 25 hours in
your day.
# Then to write the stuff out, you nest loops:
foreach $hour (sort {$a <=> $b} keys %count) { # you need a numeric
sort here
foreach $carrier(sort keys %{$count{$hour}}) { # each element of
%count is a reference to a hash
$OV = $count{$hour}{$carrier}{OV};
$SP = $count{$hour}{$carrier}{SP};
$carrier =~ s/ZZZZ//; # get rid of the 'ZZZZ' ahead of 'Total',
if this is a total
$hour =~ s/^25$/Final/; # very last line
write; # variables to write are $hour, $carrier, $OV & $SP
}
}
>
> The problem is that my boss doesn't like the format. He wants the number
> of
> ov and sp boxes on one line for each carrier for each hour. He wants it
> this way:
>
> Hour Released Carrier Bin boxes(ov) Bulk Boxes(sp)
>
> 08:00 LANREL 110 541
> 08:00 IOWA 101 257
>
> Hour 08:00 Totals 211 789
>
> #This goes on for every hour that there are records for. Then there is a
> grand total at the end:
>
> Final Totals 689 1145
>
> How the hell can I
> do this!?! I am lost and would really appreciate any help you could
> offer.
>
> Thanks!
> Michael
>
> Thanks to the people who responded. Unfortunately, I still can't get it
> to
> work even after spending several more hours at it.
------------------------------
Date: Mon, 21 Apr 1997 10:25:39 -0400
From: Dan Evens <dan.evens@hydro.on.ca>
Subject: Re: To DLL or Not to DLL what is the answer?
Message-Id: <335B78E3.548C@hydro.on.ca>
M A wrote:
>
> I have a question about programming in General.
>
> Many people think we should use as many DLL posible in our application.
> This is a great path if we have to Upgrade the same app near the future.
>
> However what is the point of EXE. We should all start programming in VB
> again.
The tendancy is to put "utility" stuff in DLLs. That is, code that is
going to get used by several other codes. In Windows, things like the
menus, scroll bars, dialog boxes, etc. are great candidates for a DLL.
Stuff that is unlikely to be used by more than one program is not a
good candidate for a DLL. DLLs are not really wonderful at allowing
you to upgrade because there is some overhead to using them, both in
resource use and coding. What they are good at is sharing functionality.
--
Standard disclaimers apply.
I don't buy from people who advertise by e-mail.
I don't buy from their ISPs.
Dan Evens
------------------------------
Date: Mon, 21 Apr 1997 16:31:38 +0100
From: Brian Ewins <Brian.Ewins@gssec.bt.co.uk>
Subject: Re: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <335B885A.7ABF@gssec.bt.co.uk>
Tom Wheeley wrote:
>
> In article <87pvvuc9lw.fsf@A-abe.resnet.ucsb.edu>
> graham.hughes@resnet.ucsb.edu "Graham C. Hughes" writes:
>
> > Tim> BTW, no offense, but *why* do people post PGP signatures? Is it
> > Tim> just me, or is it completely ridiculous?
> >
> > I prefer that people have a method
> > for verifying that the mail/post came from me.
> Why would anyone want to forge one of your posts? Does anyone ever check?
I believe a case for libel/defamation was brought last year in the UK
regarding the content of a particular users USENET posts. Verification
of the real sender will almost certainly be important to you
if you are faked into court (however its more likely using PGP
in this way makes it easier for the lawyers to nail ya when
you step out of line)
See the EFF document on this topic:
http://www.eff.org/pub/Legal/bbs_defamation_liability.paper
Cheers,
Baz
--
****====---- Brian Ewins.
Fax: (44) 141 220 6100 Tel: (44) 141 220 6121
"It's time we face reality, my friends...
We're not exactly rocket scientists." --Gary Larson ----====****
------------------------------
Date: Mon, 21 Apr 1997 12:50:59 -0400
From: "Robert J. Trembley" <rtremble@ctissrv1.plt.ford.com>
Subject: Using ADO (OLEDB) from Perl
Message-Id: <335B9AF2.5391@ctissrv1.plt.ford.com>
I'm trying to get a Perl app working with ADO... but no Luck yet... I
can't get the database connect to work at all... All I want to do is
open a database, and insert some rows into a table...
The ADO help files only have the ADO specification...NO EXAMPLES!
Does anyone have an example of Perl using ADO they could send to me?
------------------------------
Date: Mon, 21 Apr 1997 17:06:36 GMT
From: hbaecker@island.net
Subject: Re: Who will win? Borland or Microsoft or Programmers?
Message-Id: <335b96a2.1955457@news.van.hookup.net>
On Fri, 18 Apr 1997 15:44:25 GMT, CubanPete@cuban.pete.com (CubanPete)
wrote:
>On Fri, 18 Apr 1997 15:14:02 GMT, Bob Nelson <bnelson@netcom.com>
>wrote:
>
>
>>
>>Forget both Borland and Micro$loth. They produce toys. GNU's gcc is
>>meant for serious development (and has the best diagnostics of any
>>compiler).
>>
>>--
>>=============================================================================
>> Bob Nelson: Dallas, Texas, U.S.A. - bnelson@netcom.com
>> UNIX...anything else is just a toy
>> Support Birmingham channel 33's FREEDOM of choice to NOT air "Ellen"
>> (I wholeheartedly agree with their programming decision, BTW)
>>=============================================================================
>>
>
>
>Wow, I didn't know gcc ran under Win95 !/?#$^^^^@%&@@@**
>
>Ellen (hl4en), Mount
>A peak, 3,514.2 m (11,522 ft) high, of southern Utah.
>
Look for djgpp, a DOS version of gcc & g++ including a DOS extender.
Free.
Harry
------------------------------
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 338
*************************************