[7666] in Perl-Users-Digest
Perl-Users Digest, Issue: 1292 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 9 10:07:27 1997
Date: Sun, 9 Nov 97 07:00:42 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 9 Nov 1997 Volume: 8 Number: 1292
Today's topics:
$5 to $50000 <postmaster@beatle.koenig.su>
anme of arrays <axelkuester@connecta.aal.circular.de>
Re: anme of arrays (brian d foy)
Re: anme of arrays (Tad McClellan)
array to scalar coercion (mysplice) <bnelson@netcom.com>
By value or reference <leurmy@akula.com>
Re: By value or reference (brian d foy)
Re: Chomp vs Chop <smantri@gmu.edu>
Re: Chomp vs Chop (brian d foy)
Re: Chomp vs Chop (Tad McClellan)
Re: dealing with frames output (Calvin W. S. Wong)
Re: dealing with frames output (brian d foy)
Re: Decimal rounding and lining up decimals? <smantri@gmu.edu>
Getting the date from a file. (Curtis [Jewell] Whalen)
Re: glob not working (Umm)
Re: glob not working (brian d foy)
Re: gurusamy sarathy win32 bin port... ran@netgate.net
Re: My, while, and continue (Charles DeRykus)
Re: output to a file <youngej@magpage.com>
PATH_INFO (UNIX vs. Novell Webserver 3.1) <rlluhman@netins.net>
perl warning annoying me <doj@cubic.org>
Re: Running Unix from inside perl script <jrj120@psu.edu>
serverside map 2 clientside map , snailgem@aol.com
Timezone conversion <kraybill@vianet.net.au>
Re: Timezone conversion (brian d foy)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 9 Nov 1997 09:14:15 GMT
From: "BeatleGoise" <postmaster@beatle.koenig.su>
Subject: $5 to $50000
Message-Id: <01bcecef$34a070c0$LocalHost@champion>
>uDELITE PQTX MINUT, ^TOBY PRO^ITATX \TOT TEKST I \TO izmenit wA[U VIZNX.
>
> Internet BYSTRO RASTET. oN UDWAIWAETSQ W RAZMERE KAVDYE 4 MESQCA.
pODUMAJTE
> OB \TOM. wY WSTRE^AETE PREDLOVENIQ TIPA "Make.Money.Fast", KOTORYE
OTPRAWLQ@T
> PO PO^TE W BOLX[OM KOLI^ESTWE. |TO - ... POTOMU, ^TO \TO rabotaet! i Q
RE[IL
> PROBOWATX \TO NESKOLXKO MESQCEW NAZAD. dA I ^TO TAKOE $5? mY TRATIM
BOLX[E NA
> SIGARETY, KOFE I PRO^EE W TE^ENIE DNQ. tAK ^TO Q OTPRAWIL DENXGI PO
PO^TE.
>
> dWE NEDELI SPUSTQ Q NA^AL POLU^ATX DENXGI PO PO^TE! q NIKOGDA BY NE
POWERIL!
> i SOWSEM NE MALENXKIE. sNA^ALA TOLXKO NESKOLXKO SOTEN DOLLAROW, NEDELEJ
POZVE
> - PARA TYSQ^, ZATEM - REZKOE UWELI^ENIE. k KONCU ^ETWERTOJ NEDELI PRI[LO
> PO^TI $47,000.00. oNI PRIBYLI SO WSEGO MIRA. i \TO - SOWER[ENNO ZAKONNO.
> q MOG OPLATITX WSE MOI S^ETA I E]E OSTAWALOSX DOSTATO^NO, ^TOBY HORO[O
> OTDOHNUTX WO WREMQ OTPUSKA S SEMXEJ.
>
> |TO RABOTAET NE TOLXKO NA MENQ, NO I DLQ DRUGIH TAKVE. Markus Valppu
SOOB]AET
> ^TO ON POLU^IL $57,883 ^EREZ ^ETYRE NEDELI. Dave Manning UTWERVDAET ^TO
ON
> POLU^IL $53,664 ZA TO VE SAMOE WREMQ. Dan Shepstone SOOB]AET, ^TO U NEGO
BYLO
> TOLXKO $17,000. q ZNA@ \TIH L@DEJ? nET, NO KOGDA Q ^ITA@, KAK ONI DELALI
\TO,
> U MENQ NE WOZNIKAET OSNOWANIQ NE DOWERQTX IM. i E]E. $5 - \TO TA SUMMA,
> KOTORU@ MOVET INWESTIROWATX KAVDYJ BEZ U]ERBA DLQ SOBSTWENNOGO B@DVETA.
> wOT - KAK \TO RABOTAET W 3-H \TAPAH:
>
>|tap 1.
>nAPI[ITE wA[E IMQ I ADRES NA PQTI OTDELXNYH LISTAH BUMAGI WMESTE SO
SLOWAMI
>"PLEASE ADD ME TO YOUR MAILING LIST" (tAKIM OBRAZOM, wY NE TOLXKO
POSYLAETE
>DOLLAR KOMU-TO, wY OPLA^IWAETE ZAKONNOE OBSLUVIWANIE). wLOVITE BANKNOTU
>DOSTOINSTWOM 1 DOLLAR s{a (ILI 5000 RUBLEJ - ESLI POSYLAETE NA rOSSIJSKIJ
>ADRES) I OTPRAWXTE PO SLEDU@]IM PQTI ADRESAM:
nASTOQTELXNO REKOMENDU@ OBERNUTX BANKNOTU PLOTNOJ BUMAGOJ, ^TOBY ONA
(BANKNOTA)
NE BYLA WIDNA NA PROSWET. tAKIM OBRAZOM wY NE BUDETE WWODITX W ISKU[ENIE
RABOTNIKOW PO^TOWYH SLUVB I wA[E PISXMO DOJDET DO ADRESATA W ISHODNOM
WARIANTE.
> 1- Chad Collier
> 2785 Cold Springs Rd. #49
> Placerville, CA 95667
>
> 2- Steve Boltinghouse
> 1009 Bird St.
> Hannibal, MO 63401
>
> 3- Andrey Khorev rOSSIQ
> Kostyukova St. 10-81 308024 bELGOROD
> 308024 Belgorod UL. kOST@KOWA, 10-81
> Russia hOREWU aNDRE@
>
> 4- Smirnova Lubov uKRAINA
> Nevskaja St. 4/5 324029 kRIWOJ rOG
> 324029 Krivoj Rog UL. nEWSKAQ, 4/5
> Ukraine sMIRNOWOJ l@BE
5- Ruslan rOSSIQ
M.Borisovo, 2-6 236034 kALININGRAD OBL.
236034 Kaliningrad m.bORISOWO 2-6
Russia rUSLANU
>|tap 2.
> tEPERX UBERITE ADRES POD NOMEROM 1 W SPISKE, I PEREMESTITE WWERH
DRUGIE
> ADRESA. tAK, NOMER 5 STANOWITSQ NOMEROM 4 I TAK DALEE. pOMESTITE wA[
ADRES
> POD NOMEROM 5 SPISKE.
>
>|tap 3.
> oTPRAWXTE PO PO^TE \TU STATX@ W PO KRAJNEJ MERE 250 TELEKONFERENCIJ.
> pOMNITE, ^EM BOLX[E BUDET GRUPP NOWOSTEJ, PO KOTORYM wY OTPRAWITE
STATX@,
> TEM BOLX[EE KOLI^ESTWO L@DEJ UWIDQT wA[U STATX@ I PO[L@T wAM NALI^NYE!
>
>|tap 4.
> tEPERX wY W BIZNESE, KOTORYJ RABOTAET NEPOSREDSTWENNO NA wAS, I MOVETE
> OVIDATX POLU^ENIQ DOHODOW OT 7 DO 20 DNEJ (W ZAWISIMOSTI OT RABOTY
> PO^TOWOJ SLUVBY). pOMNITE, Internet - OGROMEN. wY NI^EGO NE TERQETE,
> TOLXKO PRIOBRETAETE.
>
> tEPERX KAK I PO^EMU \TA SISTEMA RABOTAET:
> oT KAVDOGO BLOKA 250 POSLANIJ Q POLU^IL 5 OTWETOW. dA, TOLXKO 5 (IH
MOVET
> BYTX I BOLX[E, NO ISHODIM IZ MINIMALXNOGO KOLI^ESTWA). wY POLU^AETE $5
> NALI^NYMI S wA[IM ADRESOM POD NOMEROM 5.
>
> kAVDYJ DOPOLNITELXNYJ KORRESPONDENT, POSLAW[IJ wAM $1.00 TEPERX TAKVE
> DELAET 250 DOPOLNITELXNYH OTPRAWLENIJ PO PO^TE S wA[IM ADRESOM POD
NOMEROM
> 4 - 1000 POSLANIJ. w SREDNEM 50 ^ELOWEK WY[L@T wAM $1.00 S wA[IM
ADRESOM
> POD NOMEROM 4, - ... $50.00 W wA[EM KARMANE!
>
> tEPERX \TI 50 NOWYH L@DEJ SDELA@T 250 OTPRAWLENIJ PO PO^TE KAVDYJ S
wA[IM
> ADRESOM POD NOMEROM 3 ILI 10 000 OTPRAWLENIJ. sREDNEE WOZWRA]ENIE, 500
> ^ELOWEK - $500. oNI DELA@T 250 OTPRAWLENIJ PO PO^TE KAVDYJ S wA[IM
ADRESOM
> POD NOMEROM 2. 100 000 POSLANIJ = 5000 WOZWRA]ENIJ W $1.00 KAVDYJ
> = $5,000.00 NALI^NYMI!
>
> nAKONEC, 5,000 L@DEJ DELA@T 250 OTPRAWLENIJ PO PO^TE KAVDYJ S wA[IM
> ADRESOM POD NOMEROM 1 I wY POLU^AETE $60,000 PERED TEM, KAK wA[ ADRES
> UBERUT IZ SPISKA. i \TO ESLI KAVDYJ DELAET TOLXKO 250 OTPRAWLENIJ. wA[
> OB]IJ DOHOD OT ODNOGO CIKLA - $55,000.
>
> kOGDA wY WIDITE, ^TO wA[EGO ADRESA BOLX[E NE W SPISKE, wY BERETE
POSLEDNEE
> POSLANIE, I NA^INAETE WSE SNA^ALA.
>
> kONE^NYJ REZULXTAT ZAWISIT OT wAS. wY DOLVNY PEREOTPRAWLQTX \TU STATX@
W
> L@BOE MESTO,KOTOROE wY ZNAETE. ~EM BOLX[E OTPRAWLENIJ PO PO^TE wY
DELAETE,
> TEM BOLX[E NALI^NYH OKAVETSQ W wA[EM PO^TOWOM Q]IKE.
>
> iTAK, WSE O^ENX PROSTO. nO POWERXTE MNE, \TO RABOTAET. kAVDYJ DENX
> MILLIONY L@DEJ WYHODQT W sETX, DOBAWLQ@TSQ 100 000 NOWYH POLXZOWATELEJ
> EVEDNEWNO. pOPROBUJTE, SLEDUQ PROSTYM INSTRUKCIQM, I POPYTAJTE UDA^U.
>
> eSLI wY NE UWERENY W USPEHE ILI WSE E]E DUMAETE, ^TO \TO NEREALXNO,
TOGDA
> NE DELAJTE \TOGO. nO,POVALUJSTA, RASPE^ATAJTE \TU STATX@ I PEREDAJTE
TOMU,
> KTO DEJSTWITELXNO NUVDAETSQ W DENXGAH, I SMOTRITE, ^TO IZ \TOGO
POLU^ITSQ.
>
> pomnite ... ~estnostx - samaq lu~{aq politika.
> wy ne dolvny diskreditirowatx osnownu` ide` delatx denxgi!
> wsem uda~i!
>
>*** mEVDU PRO^IM, ESLI wY POPROBUETE OBMANUTX L@DEJ, OTPRAWLQQ PO PO^TE
>SOOB]ENIQ S wA[IM ADRESOM W SPISKE I NE POSYLAQ DENXGI L@DQM, UVE
WKL@^ENNYM W
>SPISOK, wY NE POLU^ITE MNOGO. q ZNA@ KOE-KOGO, KTO DELAL \TO, I POLU^IL
$50
>(I TO - POSLE DWUH MESQCEW). tOGDA ON POSLAL 5 PISEM S DENXGAMI, L@DI
>DOBAWLQLI EGO K IH SPISKAM, I ^EREZ 4-5 NEDELX ON IMEL BOLEE ^EM $10,000!
------------------------------
Date: Sun, 09 Nov 1997 10:52:46 +0100
From: "Axel K|ster" <axelkuester@connecta.aal.circular.de>
Subject: anme of arrays
Message-Id: <346587EE.D06CFBD1@connecta.aal.circular.de>
hello,
i4m just starting to write programs in perl and my qestion may sound a
little silly for "old" freak.
my prolem is:
i invoke a perl-script with an string as ARGV][0]. The copntents of this
string shall be the name of an array.
example:
$ abc.pl test
.
.
$VAR1=$ARGV[0]
.
.
<somthing like> @($VAR1)=qw($a $b $c $d) or somthing like this.
is this possible??
Any suggestions welcome, even RFM (read your fucking manual), but where
to find something about this?
Thanks, Axel
axelkuester@connecta.aal.circular.de
------------------------------
Date: Sun, 09 Nov 1997 08:24:56 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: anme of arrays
Message-Id: <comdog-ya02408000R0911970824560001@news.panix.com>
In article <346587EE.D06CFBD1@connecta.aal.circular.de>, "Axel K|ster" <axelkuester@connecta.aal.circular.de> wrote:
>i invoke a perl-script with an string as ARGV][0]. The copntents of this
>string shall be the name of an array.
>example:
>
>$ abc.pl test
>$VAR1=$ARGV[0]
><somthing like> @($VAR1)=qw($a $b $c $d) or somthing like this.
you can use a symbolic reference
use vars qw($var1);
@{$var1} = ($a, $b, $c, $d);
and so on. the panther book [1] has all sorts of good examples about this
sort of thing.
[1]
Advanced Perl Programming
Sriram Srinivasan
ISBN 1-56592-220-4
<URL:http://www.oreilly.com>
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Sun, 9 Nov 1997 07:50:30 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: anme of arrays
Message-Id: <63f446.nr.ln@localhost>
Axel K|ster (axelkuester@connecta.aal.circular.de) wrote:
: my prolem is:
: i invoke a perl-script with an string as ARGV][0]. The copntents of this
: string shall be the name of an array.
: example:
: $ abc.pl test
: $VAR1=$ARGV[0]
: <somthing like> @($VAR1)=qw($a $b $c $d) or somthing like this.
: is this possible??
Yes.
-----------------
#!/usr/bin/perl
# print the contents of the array named by the first argument
die "must provide an argument" unless @ARGV > 0;
@foo = qw/one two three four five/;
@bar = qw/six seven eight nine/;
@foobar = qw/one two three four five six seven eight nine/;
$var1 = $ARGV[0];
foreach (@$var1) {print "$_\n"}
-----------------
: Any suggestions welcome, even RFM (read your fucking manual), but where
: to find something about this?
That would be the 'perlref' man page.
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 9 Nov 1997 09:17:16 GMT
From: Bob Nelson <bnelson@netcom.com>
Subject: array to scalar coercion (mysplice)
Message-Id: <643v2s$8h7$1@renpen.nelson.org>
Both the ``perlsub'' man page and "Programming Perl (2nd Edition)" show
the following declaration and call for the ``mysplices'' subroutine:
sub mysplice (\@$$@) mysplice @array,@array,0,@pushme
Here's a less ambitious subroutine yielding the diagnostic: ``Bizarre
copy of ARRAY in aassign at ...''. How can this be in light of the
fact that ``...an argument represented by $ forces scalar context''?
Here's the code:
------------------------------------------------------------------------
sub ary_and_len(\@$) {
my($aref, $e) = @_;
print "array has $e elements, as follows:\n";
foreach(@$aref) {
print "$_\n";
}
}
@a = ('one', 'two', 'three');
# The following works (of course):
# ===============================
ary_and_len @a, $#a + 1;
# The following fails (BIZARRE copy...). Why isn't the second ``@a''
# argument coerced to a scalar with a prototype in scope?
# ===================================================================
ary_and_len @a, @a;
__END__
Summary of my perl5 (5.0 patchlevel 4 subversion 3) configuration:
Platform:
osname=linux, osvers=2.0.30, archname=i586-linux
uname='linux renpen 2.0.30 #2 fri aug 15 01:12:20 cdt 1997 i586 unknown '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=y useperlio=undef d_sfio=undef
Compiler:
cc='gcc', optimize='-O2', gccversion=2.7.2.3
cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
stdchar='char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=4, usemymalloc=n, randbits=31
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lndbm -lgdbm -ldb -ldl -lm -lc
libc=/lib/libc.so.5.4.37, so=so
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
--
========================================================================
Bob Nelson -- Dallas, Texas, USA (bnelson@iname.com)
http://www.geocities.com/ResearchTriangle/6375
========================================================================
------------------------------
Date: Sun, 09 Nov 1997 01:02:10 -0500
From: Francois <leurmy@akula.com>
Subject: By value or reference
Message-Id: <346551E2.BDB75EA5@akula.com>
Is it possible to assign the value of a variable to another variable and
that this new variable keeps that same value even if the first variable
changes its value?
I'm trying to parse a "multipart/form-data" form but it seems that all
the variables to which I assigned a value thru a same variable (but at
different times with different values) at the end get one same value..
I have a While loop that reads the <STDIN>...and a @data_stream that
gets the value from the form for each field.
if ($field_name == "your_name") {
$self{'your_name'} = join ("", @data_stream);
} elsif ($field_name == "language") {
$self{'language'} = join ("", @data_stream);
} elsif ($field_name == "program_cb") {
$self{'program_cb'} = join ("", @data_stream);
}
While I would expect each $self{'....'} variable to get different
values, it seem s that they all have the same value.
Thanks,
Francois
------------------------------
Date: Sun, 09 Nov 1997 02:35:33 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: By value or reference
Message-Id: <comdog-ya02408000R0911970235330001@news.panix.com>
In article <346551E2.BDB75EA5@akula.com>, Francois <leurmy@akula.com> wrote:
>Is it possible to assign the value of a variable to another variable and
>that this new variable keeps that same value even if the first variable
>changes its value?
$a = 'some value';
$b = $a;
$a = 'a different value';
print "$b\n";
>I have a While loop that reads the <STDIN>...and a @data_stream that
>gets the value from the form for each field.
>
> if ($field_name == "your_name") {
> $self{'your_name'} = join ("", @data_stream);
> } elsif ($field_name == "language") {
> $self{'language'} = join ("", @data_stream);
> } elsif ($field_name == "program_cb") {
> $self{'program_cb'} = join ("", @data_stream);
> }
>
>While I would expect each $self{'....'} variable to get different
>values, it seem s that they all have the same value.
well, you're assigning the same thing to each of them, so why should
they be different?
you'll also want to use eq rather than == for string comparisons.
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Sun, 9 Nov 1997 04:14:10 -0500
From: shiva mantri <smantri@gmu.edu>
To: Faust Gertz <faust@wwa.com>
Subject: Re: Chomp vs Chop
Message-Id: <Pine.OSF.3.95q.971109040531.22043B-100000@osf1.gmu.edu>
Hi,
heres what i did.
---------
#!/usr/local/bin/perl
$/ = "i";
$_ = <STDIN>; chop; print;
_________
if my input string is "This is my input string" which has a new line
character at the end.
Chop didnt remove the last character. In both chop and chomp, it removed
everything after the first character defined in $/ (which is "i" in this
case. So it returned "th" only).
Can anyone explain this phenomenon?????
Thanks
shiva..
On Fri, 7 Nov 1997, Faust Gertz wrote:
:On Fri, 07 Nov 1997 12:40:41 -0500, Matt Pezzuto <mpezzuto@link.com>
:wrote:
:
:>My one friend and I got in an argument about chomp vs chop.
:
:Very bloody wars have be fought over this very topic.
:
:>My one friend is an perl guru and I am a newbie and I'm
:>reading books and stuff. Well,I few weeks ago I had my friend
:>write a perl script for me and he used chop to get ride of an
:>eol.
:
:Sounds legitimate.
:
:>While I was learning perl I learned it was safer to use
:>chomp if your only purpose is to get ride of an eol.
:
:Did you also learn TIMTOWTDI?
:
:>I asked my friend why he didn't use chomp. He didn't know about it
:>and asked what it did and I told him.
:
:Some guru.
:
:>But after thinking for a second he replied by saying,
:>"When would ever not know what your chopping off?"
:
:Not a native speaker of english either.
:
:>I failed to come up with an example and he claimed that using chomp was half-hazard
:>way of programming because the programmer should know whether or
:>not an eol is expected to not and chop is quicker than chomp because
:>it doesn't have to check to make sure the last character is an eol.
:
:I don't know if it is 'half-hazard' way of programming. *chop* and
:*chomp* are usually used to remove the newline character from the end
:of a string and are probably almost always more efficient than
:s/\n$//. *chop* removes (and returns) the last character of the
:string passed to it. *chomp* removes the record separator, the value
:of $/, and returns the number of characters removed. So they do
:different things and return different things. It is my feeling that
:*chomp* is probably better to use than *chop* for removing newline
:characters as it will only chop off the last character(s) if equal to
:the value of $/ and thus takes care of some cross-platform issues. On
:Windows it will remove both the return character and the newline
:character instead of just lobbing off the last character. This might
:be the type of example your guru friend was seeking.
:
:>I replied with then why did they make chomp? I do not totally agree
:>with him but I have to admit that he has a point. Who is right, the
:>newbie or the guru?
:
:You are both wrong. :-)
:
:
:Streben nach Wahrheit
:
:Faust Gertz
:Philosopher at Large
:
:"Diego used to be a guard at the Museum of Modern Art. He was on the
:night shift. His job was to go around the museum and tell people to
:leave. Or, as he put it, 'Snap them out of their art trances.'
:People who'd been standing in front of one thing for hours, he would
:jump in front of them and snap his fingers, and he'd say, 'Time to
:go.'" -- Laurie Anderson, 'Time To Go (for Diego)'
:
:
:
:
:
Shiva Mantri
---
7032738119,7039938736
------------------------------
Date: Sun, 09 Nov 1997 08:17:53 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Chomp vs Chop
Message-Id: <comdog-ya02408000R0911970817530001@news.panix.com>
In article <Pine.OSF.3.95q.971109040531.22043B-100000@osf1.gmu.edu>, smantri@gmu.edu wrote:
>#!/usr/local/bin/perl
>
>$/ = "i";
>$_ = <STDIN>; chop; print;
>if my input string is "This is my input string" which has a new line
>character at the end.
>Chop didnt remove the last character. In both chop and chomp, it removed
>everything after the first character defined in $/ (which is "i" in this
>case. So it returned "th" only).
if $INPUT_RECORD_SEPARATOR is set to 'i', then what is in $_ when you
type "This is my input string"? once you know that you have your
answer.
just go through the standard debugging practice of checking your data
at each step of the process.
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Sun, 9 Nov 1997 07:58:16 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Chomp vs Chop
Message-Id: <ohf446.6t.ln@localhost>
shiva mantri (smantri@gmu.edu) wrote:
: heres what i did.
: ---------
: #!/usr/local/bin/perl
:
: $/ = "i";
: $_ = <STDIN>; chop; print;
: _________
: if my input string is "This is my input string" which has a new line
: character at the end.
Newline characters no longer mark the end of a 'chunk'
The character 'i' now marks the end of a chunk.
You told perl that this is what you wanted to do when you set
$/ = 'i' ...
: Chop didnt remove the last character.
Yes it did. It removed the 'i', which was the last character.
The 's is my input string' was *never read*, since you only read
one chunk from STDIN
: In both chop and chomp, it removed
: everything after the first character defined in $/ (which is "i" in this
: case. So it returned "th" only).
: Can anyone explain this phenomenon?????
try this:
---------
#!/usr/bin/perl
$/ = "i";
while (<DATA>) {
print "'$_'\n";
}
__DATA__
This is my input string
_________
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 09 Nov 1997 06:22:45 GMT
From: cwswong@schoolmail.com (Calvin W. S. Wong)
Subject: Re: dealing with frames output
Message-Id: <34655630.2956157@news.netteens.net>
On Sat, 08 Nov 1997 16:11:54 -0500, Bill Guindon
<billg@networkapparel.com> wrote:
>I'm not sure exactly how you can do it, but it looks like you need a:
>TARGET="_top"
That works fine if it's an anchor <A HREF="...." TARGET="_top">,
but seems that can't use with [ print "Location: index.html
target="_top" ]
Calvin Wong.
------------------------------
Date: Sun, 09 Nov 1997 02:38:07 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: dealing with frames output
Message-Id: <comdog-ya02408000R0911970238070001@news.panix.com>
In article <34655630.2956157@news.netteens.net>, cwswong@schoolmail.com (Calvin W. S. Wong) wrote:
>On Sat, 08 Nov 1997 16:11:54 -0500, Bill Guindon
><billg@networkapparel.com> wrote:
>
>>I'm not sure exactly how you can do it, but it looks like you need a:
>>TARGET="_top"
>That works fine if it's an anchor <A HREF="...." TARGET="_top">,
>but seems that can't use with [ print "Location: index.html
>target="_top" ]
if you want to play with frames, read the docs in the CGI Meta FAQ
which answer this question.
good luck :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Sun, 9 Nov 1997 04:21:26 -0500
From: shiva mantri <smantri@gmu.edu>
To: Jeff Hughes <jhughes@iastate.edu>
Subject: Re: Decimal rounding and lining up decimals?
Message-Id: <Pine.OSF.3.95q.971109041721.22043C-100000@osf1.gmu.edu>
use printf function
printf "%2.2f", $dollar_val;
shiva
On 7 Nov 1997, Jeff Hughes wrote:
:
: I'm working with dollar amounts, which sometimes get multiplied and
:result in something like 45.375 Other than breaking it apart and putting
:it back together as a string, what's the quickest way to turn it into 45.38?
:I have something right now, but it just looks/seems too slow.
:
: Also the Camel book mentions output formatting using # and . for lining
:up numerical values but doesn't give any suggestions. Nothing I've tried
:seems to work.
:
:Please mail any suggestions, thanks.
:
:
: Jeff
:
:
Shiva Mantri
---
7032738119,7039938736
------------------------------
Date: Sun, 09 Nov 1997 06:17:13 GMT
From: curtis_whalen@hotmail.com (Curtis [Jewell] Whalen)
Subject: Getting the date from a file.
Message-Id: <643kh9$37c_002@snews.zippo.com>
Environment: Perl 5.004_03, i86pc-solaris osver = 2.5.1
What I need to do is to get the date and time that a file has been MODIFIED
LAST, preferably in Perl..
I'm working on a CGI script that needs to create a CDF (Channel Definition
Format) file that needs this information.
--Curtis
--Curtis
Mail to the address above will be treated as SPAM and deleted unread.
Send replies to curtis_whalen (at) geocities.com
ebius tagline. This is a moebius tagline. This is a mo ...
------------------------------
Date: 9 Nov 1997 03:18:31 GMT
From: l41484@alfa.ist.utl.pt (Umm)
Subject: Re: glob not working
Message-Id: <643a27$oph$1@ci.ist.utl.pt>
Tad McClellan (tadmc@flash.net) wrote:
: Umm (l41484@alfa.ist.utl.pt) wrote:
: : Is there any reason, why glob doesn't work???
: You have not given us enough information to even tell if it is
: working or not.
sorry.
: The result you give is "working right" if there are no files with
: a '.pl' filename extension in the current directory.
but there are. :-)
: glob() may return more than one filename.
: Where would they go? (answer: the first one goes in $tst, the rest
: are discarded...)
I'm aware of that. and it doesn't really matter, the first one will be
enough. Because i'm using glob to determine the home of a user. :-)
what i've discovered is (someone correct me if i'm wrong) perl relies on the
csh to glob, and i don't have csh installed. :-(
--
Tiago Umm Pascoal
'The unstoppable mail machine'
l41484@alfa.ist.utl.pt
I believe in making trouble. If women have any duty at all, essentially
it's to be a pain in the arse. (avital ronell)
------------------------------
Date: Sun, 09 Nov 1997 02:40:08 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: glob not working
Message-Id: <comdog-ya02408000R0911970240080001@news.panix.com>
In article <643a27$oph$1@ci.ist.utl.pt>, l41484@alfa.ist.utl.pt (Umm) wrote:
>I'm aware of that. and it doesn't really matter, the first one will be
>enough. Because i'm using glob to determine the home of a user. :-)
why? there are environment variables for such things, and lots of other
less wasteful ways to do it.
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 9 Nov 1997 07:54:13 GMT
From: ran@netgate.net
Subject: Re: gurusamy sarathy win32 bin port...
Message-Id: <643q75$pm4@ss.netgate.net>
In <345F0C4F.1AF@icl.fi>, Petri Backstrom <petri.backstrom@icl.fi> writes:
>I'm not sure why IE changes the ".gz" to ".tar"
It's all the fault of the U.S. government: the pending anti-trust action
forced Microsoft to delay its plan to take over the internet, and
eliminate all those weird non-8.3 filenames. Unfortunately, the
development team assumed that the plan would be complete before
the release of Exploder 4.0, and coded accordingly...
------------------------------
Date: Sun, 9 Nov 1997 02:25:04 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: My, while, and continue
Message-Id: <EJCxDs.3rB@bcstec.ca.boeing.com>
In article <63thq7$2f7@bgtnsc03.worldnet.att.net>,
Doug Harrison <dHarrison@worldnet.att.net> wrote:
> Is a variable declared with "my" in a while loop supposed to be
> available in the loop's continue clause? It is in Perl for Win32,
> 5.003_07, but only in the first statement of the continue clause. For
> example, when I run the following:
>
> $x = 0;
> while ($x++ != 2)
> {
> my $y = "test";
> }
> continue
> {
> print "1 $y\n";
> print "2 $y\n";
> }
>
> The output is:
>
> 1 test
> 2
> 1 test
> 2
>
> After "1 test" is printed, $y becomes empty. Anyone know what the
> expected result is?
>
I'd have expected this:
1
2
1
2
What happens if you replace the "my" with "local" ?
HTH,
--
Charles DeRykus
------------------------------
Date: 9 Nov 1997 14:10:26 GMT
From: Ed Young <youngej@magpage.com>
To: Myles Lawrence <myleslawrence@email.msn.com>
Subject: Re: output to a file
Message-Id: <644g8i$ch1$0@204.179.92.73>
Myles Lawrence wrote:
>
> I use a dababase query to format html pages. How dcan I get that output to a
> formateed fie so I bring it into Word without a lot of additional
> formatting?
> myleslawrence@msn.com
Use perl (of course). Read the database with "use Win32::ODBC;", use
"here-docs" (see perldata) for the bulk of your HTML. You may not need
Word...
------------------------------
Date: Sun, 9 Nov 1997 07:56:12 -0600
From: "Rick" <rlluhman@netins.net>
Subject: PATH_INFO (UNIX vs. Novell Webserver 3.1)
Message-Id: <644fk8$deo$1@insosf1.netins.net>
The Novell Webserver 3.1 appears to not be completely compatible with the
UNIX PATH_INFO command. The following script works on a UNIX machine but
not on the Novell Webserver. Is there any tweaking that needs to be done to
this script to allow it to run on the Novell Webserver?
print "Content-type: text/html\n\n";
print "Path Info = <b>$ENV{'PATH_INFO'}</b>\n";
------------------------------
Date: Sun, 09 Nov 1997 14:20:29 +0100
From: doj <doj@cubic.org>
Subject: perl warning annoying me
Message-Id: <3465B89D.618D@cubic.org>
Hello Freak,
I'm using a RedHat Linux and Perl 5.004.
I do not use the perl that came with the distribution, but compiled the
new version for myself. It seems to run fine, but every time it starts I
get the following warnings:
warning: setlocale(LC_CTYPE, "") failed.
warning: LC_ALL = "(null)", LC_CTYPE = "(null)", LANG = "ko",
warning: falling back to the "C" locale.
now these annoy me to hell.
Question: how can I get rid of these warnings ???
--
---> doj / cubic
----> Gott weisz ich will kein Tracker sein !
-----> http://www.cubic.org
------> EXPLORE THE MEKKA/SYMPOSIUM '97 CD-ROM ON THE WEB PAGES !!!
------------------------------
Date: Sun, 09 Nov 1997 01:25:50 +0000
From: James Juran <jrj120@psu.edu>
Subject: Re: Running Unix from inside perl script
Message-Id: <3465111E.3CE03B6A@psu.edu>
tbergman@tkb.com wrote:
> I am attempting to interact with the telnet program from within a perl
> program. The task is simply to verify a list of email addresses at a
> particular domain. Perl provides facilities to pipe input either from or
> to a unix program. I can get the perl program to launch telnet with a
> command such as:
>
> open (IN,"telnet somewhere.com 25 |");
> while (<IN>){
> print "$_";
> }
>
> This captures the output of the telnet program and prints it to the
> screen. At this point I get stuck. I cannot seem to send any additional
> strings to the telnet program. I have tried to open additional handles. I
> have tried to use the backquote mechanism to execute a command in
> unix--but to no avail. Can you tell me how to send additional information
> to the active telnet session. I need to perform some processes between
> strings sent that depend on the output I am getting from the telnet
> session, e.g. save good addresses to another file, get the next address,
> etc.
>
You might want to check out the Net::Telnet module. It should be
somewhere under http://www.perl.com . IMHO, it's significantly easier
to use than using telnet as a shell process and trying to read its
output.
James Juran
jrj120@psu.edu
------------------------------
Date: Sun, 09 Nov 1997 09:45:41 -0500
From: , snailgem@aol.com
Subject: serverside map 2 clientside map
Message-Id: <3465CC95.33F0@aol.com>
Does anybody know of any UNIX scrips out there (whatever it's written
in, but PERL would be best) that, given a .map file (server side HTML
image map), can convert it to a client-side map?
Thanks.
------------------------------
Date: Sun, 09 Nov 1997 08:59:52 +0800
From: Gene Kraybill <kraybill@vianet.net.au>
Subject: Timezone conversion
Message-Id: <34650B08.45D1@vianet.net.au>
I'm relatively new to Perl and am working on a Calendar script in which
I capture times/dates for events.
I'd like to automatically convert a local time into GMT when a new event
is recorded, and on display, I'd like to automatically convert the GMT
times into the local time of the viewer. Can anyone help with pointers
to scripts or methods?
Gene Kraybill
------------------------------
Date: Sun, 09 Nov 1997 08:15:14 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Timezone conversion
Message-Id: <comdog-ya02408000R0911970815140001@news.panix.com>
In article <34650B08.45D1@vianet.net.au>, Gene Kraybill <kraybill@vianet.net.au> wrote:
>I'm relatively new to Perl and am working on a Calendar script in which
>I capture times/dates for events.
>
>I'd like to automatically convert a local time into GMT when a new event
>is recorded, and on display, I'd like to automatically convert the GMT
>times into the local time of the viewer. Can anyone help with pointers
>to scripts or methods?
CPAN [1] has all sorts of great Date modules.
[1]
Comprehensive Perl Archive Network
find one near you at <URL:http://www.perl.com>
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
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 1292
**************************************