[19285] in Perl-Users-Digest
Perl-Users Digest, Issue: 1480 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 9 21:05:44 2001
Date: Thu, 9 Aug 2001 18:05:15 -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: <997405515-v10-i1480@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 9 Aug 2001 Volume: 10 Number: 1480
Today's topics:
Re: -w option changes filename variable <brentdax1@earthlink.net>
Re: -w option changes filename variable (Pete)
Re: -w option changes filename variable <somewhere@in.paradise.net>
Re: -w option changes filename variable (Pete)
Re: -w option changes filename variable <brentdax1@earthlink.net>
Re: -w option changes filename variable <ren@tivoli.com>
Re: Advise on using perl to sort and give totals <ren@tivoli.com>
Re: Advise on using perl to sort and give totals (Martien Verbruggen)
Re: Advise on using perl to sort and give totals <brentdax1@earthlink.net>
CGI.pm --> open FILE,">>file.txt"; <viper16336@mindspring.com>
Re: CGI.pm --> open FILE,">>file.txt"; (Eric Bohlman)
Re: CGI.pm --> open FILE,">>file.txt"; <brentdax1@earthlink.net>
Re: CGI.pm --> open FILE,">>file.txt"; <somewhere@in.paradise.net>
Coercing list context onto pair of regexps in a compari (pt)
Re: Coercing list context onto pair of regexps in a com (Eric Bohlman)
Re: Coercing list context onto pair of regexps in a com <uri@sysarch.com>
Re: Coercing list context onto pair of regexps in a com <brentdax1@earthlink.net>
Re: Coercing list context onto pair of regexps in a com <tinamue@zedat.fu-berlin.de>
Re: Coercing list context onto pair of regexps in a com <tinamue@zedat.fu-berlin.de>
Re: Coercing list context onto pair of regexps in a com <krahnj@acm.org>
Re: Comparing data in two different files <godzilla@stomp.stomp.tokyo>
Re: Converting a string to an Integer <Pcmann1@btinternet.com>
Re: Converting a string to an Integer (Tad McClellan)
Does anyone have a program for this?? (Daniel)
Re: Does anyone have a program for this?? <projectobjects@earthlink.net>
FAQ: How do I pack arrays of doubles or floats for XS c <faq@denver.pm.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 09 Aug 2001 23:00:25 GMT
From: "Brent Dax" <brentdax1@earthlink.net>
Subject: Re: -w option changes filename variable
Message-Id: <dCEc7.1435$2M3.125124@newsread1.prod.itd.earthlink.net>
"Pete" <Peter@angeltec.fsnetNOTTHIS.co.uk> wrote in message
news:3b72be98.91662146@news.btinternet.com...
> Hi,
>
> when running perl with the -w option :
> print $0 gives filename
>
> without the -w it gives ./filename.
Let me guess: you're invoking the script like
perl -w filename
for the -w testing and
./filename
for the -w-less invocations?
That's a no-no--just change the shebang line to test it with -w.
--Brent Dax
brentdax1@earthlink.net
------------------------------
Date: Thu, 09 Aug 2001 23:07:39 GMT
From: Peter@angeltec.NOTHISfsnet.co.uk (Pete)
Subject: Re: -w option changes filename variable
Message-Id: <3b73164f.10799639@news.freeserve.net>
On Thu, 09 Aug 2001 23:00:25 GMT, "Brent Dax" <brentdax1@earthlink.net> wrote:
>Let me guess: you're invoking the script like
> perl -w filename
>for the -w testing and
yes
> ./filename
>for the -w-less invocations?
no, just filename
>That's a no-no--just change the shebang line to test it with -w.
hashshriek line's at work but I'm sure it's just the path
Pete
------------------------------
Date: Fri, 10 Aug 2001 09:11:57 +1000
From: "Tintin" <somewhere@in.paradise.net>
Subject: Re: -w option changes filename variable
Message-Id: <INEc7.6$vG3.28701@news.interact.net.au>
"Pete" <Peter@angeltec.NOTHISfsnet.co.uk> wrote in message
news:3b72f43d.2076995@news.freeserve.net...
> On Thu, 9 Aug 2001 17:47:31 +0000, gnari <gnarinn@hotmail.com> wrote:
>
> >In article <3b72be98.91662146@news.btinternet.com>,
> >Pete <Peter@angeltec.fsnetNOTTHIS.co.uk> wrote:
> >>
> >>when running perl with the -w option :
> >>print $0 gives filename
> >>
> >>without the -w it gives ./filename.
> >
> >there must be something you are not telling us
> >
> >are you running the file with:
> > perl filename
> >or (it being executable):
> > filename
>
> perl -w filename when testing then just filename when finished
Well, you've just managed to answer your question.
------------------------------
Date: Thu, 09 Aug 2001 23:20:33 GMT
From: Peter@angeltec.NOTHISfsnet.co.uk (Pete)
Subject: Re: -w option changes filename variable
Message-Id: <3b7319f7.11736563@news.freeserve.net>
On Fri, 10 Aug 2001 09:11:57 +1000, "Tintin" <somewhere@in.paradise.net> wrote:
>Well, you've just managed to answer your question.
hmmm, well I can't see it - looks I'm missing something else then - apart from
a brain. Please expand.
Pete
------------------------------
Date: Fri, 10 Aug 2001 00:10:38 GMT
From: "Brent Dax" <brentdax1@earthlink.net>
Subject: Re: -w option changes filename variable
Message-Id: <2EFc7.1566$2M3.137422@newsread1.prod.itd.earthlink.net>
"Pete" <Peter@angeltec.NOTHISfsnet.co.uk> wrote in message
news:3b73164f.10799639@news.freeserve.net...
> On Thu, 09 Aug 2001 23:00:25 GMT, "Brent Dax" <brentdax1@earthlink.net>
wrote:
>
> >Let me guess: you're invoking the script like
> > perl -w filename
> >for the -w testing and
> yes
>
> > ./filename
> >for the -w-less invocations?
> no, just filename
Then you must have . in your $ENV{PATH}, right?
> >That's a no-no--just change the shebang line to test it with -w.
> hashshriek line's at work but I'm sure it's just the path
In any case, _always invoke your program the same way_. Either change the
shebang line to add and remove -w, or always invoke your file with perl
[options] filename.
------------------------------
Date: 09 Aug 2001 17:35:55 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: -w option changes filename variable
Message-Id: <m3lmksc14k.fsf@dhcp9-161.support.tivoli.com>
[Jeopardectomy]
On Thu, 09 Aug 2001, Peter@angeltec.NOTHISfsnet.co.uk wrote:
> On Thu, 9 Aug 2001 17:47:31 +0000, gnari <gnarinn@hotmail.com>
> wrote:
>
>>In article <3b72be98.91662146@news.btinternet.com>,
>>Pete <Peter@angeltec.fsnetNOTTHIS.co.uk> wrote:
>>>
>>>when running perl with the -w option :
>>>print $0 gives filename
>>>
>>>without the -w it gives ./filename.
>>
>>there must be something you are not telling us
>>
>>are you running the file with:
>> perl filename
>>or (it being executable):
>> filename
>>?
>>
>>gnari
>
> perl -w filename when testing then just filename when finished
If the current directory is not in your PATH, then you're probably
being forced to run ./filename instead.
Also, you can verify that it is not the "-w" that is causing the
problem by comparing:
perl -w filename
and
perl filename
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 09 Aug 2001 17:19:30 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Advise on using perl to sort and give totals
Message-Id: <m3r8ukc1vx.fsf@dhcp9-161.support.tivoli.com>
On 9 Aug 2001, anno4000@lublin.zrz.tu-berlin.de wrote:
> According to sammy <sammy@bigpond.net.au>:
[snip]
>> #!/usr/local/bin/perl -wl
>> $_{(split)[0]}++ while (<>);
>> print "$_\t$_{$_}" for sort { $_{$b} <=> $_{$a} } keys %_;
[snip]
> It also contains a subtle blunder: The parens around <> in the
> second line make it slurp the whole file.
What makes you say that? Those parens don't change the context.
Parens seldom (never?) change the context of what the contain.
% perl -le 'my $i=3; sub context { return unless $i--; print wantarray ? "list" : "scalar" } 1 while (context)'
scalar
scalar
scalar
[rest trimmed]
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Fri, 10 Aug 2001 10:28:56 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Advise on using perl to sort and give totals
Message-Id: <slrn9n6am8.cq.mgjv@martien.heliotrope.home>
On 9 Aug 2001 15:30:09 GMT,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> According to sammy <sammy@bigpond.net.au>:
>>
>> #!/usr/local/bin/perl -wl
>> $_{(split)[0]}++ while (<>);
>> print "$_\t$_{$_}" for sort { $_{$b} <=> $_{$a} } keys %_;
>
> It also contains a subtle
> blunder: The parens around <> in the second line make it slurp the
> whole file.
Really? Can you quote some documentation or something to substantiate
that? AFAIK they are identical.
$ perl -MO=Deparse -e 'print while (<>)'
print $_ while defined($_ = <ARGV>);
-e syntax OK
$ perl -MO=Deparse -e 'print while <>'
print $_ while defined($_ = <ARGV>);
-e syntax OK
Deparse seems to believe both are identical. The output from perl
-MO=Terse is also identical.
Martien
--
Martien Verbruggen |
Interactive Media Division | Little girls, like butterflies, need
Commercial Dynamics Pty. Ltd. | no excuse - Lazarus Long
NSW, Australia |
------------------------------
Date: Fri, 10 Aug 2001 00:53:27 GMT
From: "Brent Dax" <brentdax1@earthlink.net>
Subject: Re: Advise on using perl to sort and give totals
Message-Id: <bgGc7.1630$q46.136851@newsread2.prod.itd.earthlink.net>
"Ren Maddox" <ren@tivoli.com> wrote in message
news:m3r8ukc1vx.fsf@dhcp9-161.support.tivoli.com...
> On 9 Aug 2001, anno4000@lublin.zrz.tu-berlin.de wrote:
>
> > According to sammy <sammy@bigpond.net.au>:
>
> [snip]
>
> >> #!/usr/local/bin/perl -wl
> >> $_{(split)[0]}++ while (<>);
> >> print "$_\t$_{$_}" for sort { $_{$b} <=> $_{$a} } keys %_;
>
> [snip]
>
> > It also contains a subtle blunder: The parens around <> in the
> > second line make it slurp the whole file.
>
> What makes you say that? Those parens don't change the context.
> Parens seldom (never?) change the context of what the contain.
Seldom. The only time parens change context is when they're around the
lvalue of an assignment:
$foo=<STDIN>; #scalar context
($foo)=<STDIN>; #list context
$foo=(<STDIN>); #scalar context
($foo)=(<STDIN>); #list context
See the pattern?
--Brent Dax
brentdax1@earthlink.net
------------------------------
Date: Thu, 9 Aug 2001 17:31:41 +0100
From: "Stephen Edelblut" <viper16336@mindspring.com>
Subject: CGI.pm --> open FILE,">>file.txt";
Message-Id: <9kv364$tja$1@slb6.atl.mindspring.net>
My cgi script saves data entered on a form to file.txt (using CGI.pm). It
works fine, but it only sends it to /cgi_bin/file.txt where the cgi script
is located. I want it to send it to a file.txt in my root directory (or some
other folder other that my cgi_bin directory). The code I'm using is:
open FILE,">>file.txt";
How do I change ">>file.txt" if I want it to open
www.mysite.com/textfile/file.txt? Currently file.txt is in my cgi_bin
directory. Whatever I try never works.
I would appreciate it if someone could help. Thanks
------------------------------
Date: 9 Aug 2001 22:57:02 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: CGI.pm --> open FILE,">>file.txt";
Message-Id: <9kv4fu$54g$4@bob.news.rcn.net>
Stephen Edelblut <viper16336@mindspring.com> wrote:
> My cgi script saves data entered on a form to file.txt (using CGI.pm). It
> works fine, but it only sends it to /cgi_bin/file.txt where the cgi script
> is located. I want it to send it to a file.txt in my root directory (or some
> other folder other that my cgi_bin directory). The code I'm using is:
> open FILE,">>file.txt";
> How do I change ">>file.txt" if I want it to open
> www.mysite.com/textfile/file.txt? Currently file.txt is in my cgi_bin
> directory. Whatever I try never works.
You find out what actual *directory* the *URL* you gave maps to, and then
include its path in the filename. Remember that URLs are *not* filesystem
paths.
------------------------------
Date: Thu, 09 Aug 2001 23:03:34 GMT
From: "Brent Dax" <brentdax1@earthlink.net>
Subject: Re: CGI.pm --> open FILE,">>file.txt";
Message-Id: <aFEc7.1357$q46.116422@newsread2.prod.itd.earthlink.net>
"Stephen Edelblut" <viper16336@mindspring.com> wrote in message
news:9kv364$tja$1@slb6.atl.mindspring.net...
> My cgi script saves data entered on a form to file.txt (using CGI.pm). It
> works fine, but it only sends it to /cgi_bin/file.txt where the cgi script
> is located. I want it to send it to a file.txt in my root directory (or
some
> other folder other that my cgi_bin directory). The code I'm using is:
> open FILE,">>file.txt";
> How do I change ">>file.txt" if I want it to open
> www.mysite.com/textfile/file.txt? Currently file.txt is in my cgi_bin
> directory. Whatever I try never works.
Putting a URL in an open statement won't work. Try just saying
">>../file.txt".
If that still doesn't work, check the permissions on file.txt and make sure
it's writable by your web server's username ('nobody' on Apache).
--Brent Dax
brentdax1@earthlink.net
------------------------------
Date: Fri, 10 Aug 2001 09:08:37 +1000
From: "Tintin" <somewhere@in.paradise.net>
Subject: Re: CGI.pm --> open FILE,">>file.txt";
Message-Id: <AKEc7.4$NI3.142458@news.interact.net.au>
"Stephen Edelblut" <viper16336@mindspring.com> wrote in message
news:9kv364$tja$1@slb6.atl.mindspring.net...
> My cgi script saves data entered on a form to file.txt (using CGI.pm). It
> works fine, but it only sends it to /cgi_bin/file.txt where the cgi script
> is located. I want it to send it to a file.txt in my root directory (or
some
> other folder other that my cgi_bin directory). The code I'm using is:
> open FILE,">>file.txt";
> How do I change ">>file.txt" if I want it to open
> www.mysite.com/textfile/file.txt? Currently file.txt is in my cgi_bin
> directory. Whatever I try never works.
> I would appreciate it if someone could help. Thanks
Alot of it depends on permissions and how your webserver is configured, but
you should be able to do something like:
open FILE,">>../textfile/file.txt" or die "Can not write to
../textfile/file.txt $!\n";
------------------------------
Date: 9 Aug 2001 16:12:30 -0700
From: mnemotronic@yahoo.com (pt)
Subject: Coercing list context onto pair of regexps in a comparison
Message-Id: <da662010.0108091512.75f7c4d3@posting.google.com>
I would like to force a pair of regular expressions to be evaluted in
list context, so that they return $1.
next unless ("\L$A" =~ /.*\.(.+)$/) eq ("\L$B" =~ m#.*/(.*)$#) ;
----------------------- -----------------------
The goal is to compare the file extension portion of $A (after the
'.') with the filename portion of $B (after the last '/' delimiter),
and do something if equal/not equal. List context for each regexp
portion (underlined) will force each to return the grouped expression
($1) for the string comparison.
I have a version that uses lc, substr, and rindex instead of regular
expressions, but I'm trying Yet Another Way (for my own edification),
and to make the resulting code stylishly dense & consise (just
'cause).
------------------------------
Date: 9 Aug 2001 23:30:36 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Coercing list context onto pair of regexps in a comparison
Message-Id: <9kv6es$54g$5@bob.news.rcn.net>
pt <mnemotronic@yahoo.com> wrote:
> I would like to force a pair of regular expressions to be evaluted in
> list context, so that they return $1.
> next unless ("\L$A" =~ /.*\.(.+)$/) eq ("\L$B" =~ m#.*/(.*)$#) ;
> ----------------------- -----------------------
>
> The goal is to compare the file extension portion of $A (after the
> '.') with the filename portion of $B (after the last '/' delimiter),
> and do something if equal/not equal. List context for each regexp
> portion (underlined) will force each to return the grouped expression
> ($1) for the string comparison.
I think you've got an XY problem. You can't compare two lists, even
single-element ones, with a single operator, so there's no point in trying
to get the matches into list contexts. But with a little creativity, and
back-references, you can get the whole thing into one regex:
next unless "\L$A;$B" =~ /.*\.(.+);.*/\1$/;
I'm assuming that the filenames can't contain semicolons; if they can,
replace the semicolon with some character that can't occur in the
filenames.
------------------------------
Date: Fri, 10 Aug 2001 00:02:48 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Coercing list context onto pair of regexps in a comparison
Message-Id: <x7bslon5nd.fsf@home.sysarch.com>
>>>>> "EB" == Eric Bohlman <ebohlman@omsdev.com> writes:
EB> pt <mnemotronic@yahoo.com> wrote:
>> I would like to force a pair of regular expressions to be evaluted in
>> list context, so that they return $1.
>> next unless ("\L$A" =~ /.*\.(.+)$/) eq ("\L$B" =~ m#.*/(.*)$#) ;
>> ----------------------- -----------------------
>>
>> The goal is to compare the file extension portion of $A (after the
>> '.') with the filename portion of $B (after the last '/' delimiter),
>> and do something if equal/not equal. List context for each regexp
>> portion (underlined) will force each to return the grouped expression
>> ($1) for the string comparison.
EB> I think you've got an XY problem. You can't compare two lists,
EB> even single-element ones, with a single operator, so there's no
EB> point in trying to get the matches into list contexts. But with a
EB> little creativity, and back-references, you can get the whole
EB> thing into one regex:
you can compare a single element of a list to another single
element. just do this:
("\L$A" =~ /.*\.(.+)$/)[0] eq ("\L$B" =~ m#.*/(.*)$#)[0]
now,he may have an XY problem as well, but his request can be done easily.
EB> next unless "\L$A;$B" =~ /.*\.(.+);.*/\1$/;
EB> I'm assuming that the filenames can't contain semicolons; if they
EB> can, replace the semicolon with some character that can't occur in
EB> the filenames.
that is a poor hack. never use optimistic data assumptions or they will
byte you in the ass one day.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: Fri, 10 Aug 2001 00:07:53 GMT
From: "Brent Dax" <brentdax1@earthlink.net>
Subject: Re: Coercing list context onto pair of regexps in a comparison
Message-Id: <tBFc7.1498$q46.127693@newsread2.prod.itd.earthlink.net>
"pt" <mnemotronic@yahoo.com> wrote in message
news:da662010.0108091512.75f7c4d3@posting.google.com...
> I would like to force a pair of regular expressions to be evaluted in
> list context, so that they return $1.
>
> next unless ("\L$A" =~ /.*\.(.+)$/) eq ("\L$B" =~ m#.*/(.*)$#) ;
> ----------------------- -----------------------
>
> The goal is to compare the file extension portion of $A (after the
> '.') with the filename portion of $B (after the last '/' delimiter),
> and do something if equal/not equal. List context for each regexp
> portion (underlined) will force each to return the grouped expression
> ($1) for the string comparison.
What's wrong with just using m{(?<=\.).*$} and m{(?<=/).*$} ?
m{
(?<= #backreference
\. #make sure last character is a literal dot
) #end backreference
.* #and eat the rest
$}x #anchored to the end
------------------------------
Date: 10 Aug 2001 00:14:45 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Coercing list context onto pair of regexps in a comparison
Message-Id: <9kv91l$6mod2$1@fu-berlin.de>
pt <mnemotronic@yahoo.com> wrote:
> I would like to force a pair of regular expressions to be evaluted in
> list context, so that they return $1.
> next unless ("\L$A" =~ /.*\.(.+)$/) eq ("\L$B" =~ m#.*/(.*)$#) ;
> ----------------------- -----------------------
>
> The goal is to compare the file extension portion of $A (after the
> '.') with the filename portion of $B (after the last '/' delimiter),
> and do something if equal/not equal. List context for each regexp
> portion (underlined) will force each to return the grouped expression
> ($1) for the string comparison.
> I have a version that uses lc, substr, and rindex instead of regular
> expressions, but I'm trying Yet Another Way (for my own edification),
ok, here's another way:
next unless (($x) = "\L$A" =~ /.*\.(.+)$/g) eq (($y)="\L$B" =~ m#.*/(.*)$#g) ;
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
--- Warning: content of homepage hopelessly out-dated ---
------------------------------
Date: 10 Aug 2001 00:19:03 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Coercing list context onto pair of regexps in a comparison
Message-Id: <9kv99n$6mod2$2@fu-berlin.de>
Tina Mueller <tinamue@zedat.fu-berlin.de> wrote:
> pt <mnemotronic@yahoo.com> wrote:
>> I would like to force a pair of regular expressions to be evaluted in
>> list context, so that they return $1.
>> next unless ("\L$A" =~ /.*\.(.+)$/) eq ("\L$B" =~ m#.*/(.*)$#) ;
>> ----------------------- -----------------------
> next unless (($x) = "\L$A" =~ /.*\.(.+)$/g) eq (($y)="\L$B" =~ m#.*/(.*)$#g) ;
oops. just saw uri's posting that comes without the extra-variables...
i should go to bed.
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
--- Warning: content of homepage hopelessly out-dated ---
------------------------------
Date: Fri, 10 Aug 2001 00:27:34 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Coercing list context onto pair of regexps in a comparison
Message-Id: <3B732AD5.86687414@acm.org>
Eric Bohlman wrote:
>
> I think you've got an XY problem. You can't compare two lists, even
> single-element ones, with a single operator, so there's no point in trying
> to get the matches into list contexts. But with a little creativity, and
> back-references, you can get the whole thing into one regex:
>
> next unless "\L$A;$B" =~ /.*\.(.+);.*/\1$/;
^ ^ ^
next unless "\L$A\0$B" =~ m~\.(.+)\0.*/\1$~;
> I'm assuming that the filenames can't contain semicolons; if they can,
> replace the semicolon with some character that can't occur in the
> filenames.
John
--
use Perl;
program
fulfillment
------------------------------
Date: Thu, 09 Aug 2001 17:46:29 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Comparing data in two different files
Message-Id: <3B732EE5.A3C05097@stomp.stomp.tokyo>
John W. Krahn wrote:
> shaz wrote:
(snipped)
> open LIST, 'list.txt' or die "Cannot open list.txt: $!";
> chomp( my @list = <LIST> );
> delete @words{@list};
It is prudent to test code before posting.
Godzilla!
------------------------------
Date: Fri, 10 Aug 2001 00:16:50 +0100
From: "Peter Mann" <Pcmann1@btinternet.com>
Subject: Re: Converting a string to an Integer
Message-Id: <9kv5jd$hrj$1@neptunium.btinternet.com>
Just what I wanted! Now it works!
Thankyou!
Regards,
Pete
"Ilya Martynov" <ilya@martynov.org> wrote in message
news:874rrh6t9w.fsf@abra.ru...
>
> PM> Dear all,
> PM> I have some code that retrieves a string from a database but I
need to
> PM> convert it into an integer. Could someone please tell me if a library
and
> PM> function exists to do this, and where it is located!
>
> my $int = int($str);
>
> See 'perldoc -tf int' for more info.
>
> --
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> | Ilya Martynov (http://martynov.org/)
|
> | GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6
|
> | AGAVA Software Company (http://www.agava.com/)
|
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: Thu, 9 Aug 2001 18:47:10 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Converting a string to an Integer
Message-Id: <slrn9n64ne.sqb.tadmc@tadmc26.august.net>
Peter Mann <Pcmann1@btinternet.com> wrote:
> I have some code that retrieves a string from a database but I need to
>convert it into an integer.
Why do you think that you need to do that?
If you use a string where perl was expecting a number, it will
automatically convert the string into a number.
Perl programmers very very seldom need to know how to convert
a string into a number, since perl will just do it for them.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 9 Aug 2001 16:58:58 -0500 (CDT)
From: skateboarder05@webtv.net (Daniel)
Subject: Does anyone have a program for this??
Message-Id: <5646-3B7307A2-7@storefull-284.iap.bryant.webtv.net>
Looking for a very very very basic HTML editor/basic file manager. Plain
text interface HTML editor and basic functions file manager (new,
delete, copy, move, new dir, rename) combined in one Perl program if
anyone can please help me?!? Here's some more info...
Ok I am on webtv. And my dad is also on webtv. Well you see, he needs a
word processor but there are no "REAL" word processors out there
available for webtv since you cannot download. People have attempted to
create word processor type webpages but they really don't know what they
are doing. Ok first of all the word processors already out there are
just HTML editors. Now you see, one of these HTML Editor/Word processor
sites has actually got something going...Except you cannot save. You
just have to print. But my goal is to make a word processor on my web
server for my dad to use. I know a little about Perl but I am no
programmer. I merely know how to install scripts, ect. What I am wanting
to do is find a very simple HTML editor/file manager and edit the
interface of the editor and transform it into sort of a word processor.
I will use scroll menus to insert the codes into the input box so even
the non-technical type of person (my dad) can create a printable HTML
document. Well that's the easy part but the hard part is finding a very
simple perl script that will let me take the input and save it in a
special directory, re-open documents that are saved, and manage the
files...It's probably very easy for a programmer who knows Perl but for
me it's a hard task. Please help! Any help would be very much
appreciated!!
Daniel
------------------------------
Date: Thu, 09 Aug 2001 22:48:12 GMT
From: "Dale Henderson" <projectobjects@earthlink.net>
Subject: Re: Does anyone have a program for this??
Message-Id: <MqEc7.1311$q46.113544@newsread2.prod.itd.earthlink.net>
WebRSH has a plain text editor included in its package. You could probably
scale it down to just a text editor if necessary
http://www.geocities.com/SiliconValley/Horizon/7772/webrsh.html
dalehend@yahoo.com
"Daniel" <skateboarder05@webtv.net> wrote in message
news:5646-3B7307A2-7@storefull-284.iap.bryant.webtv.net...
> Looking for a very very very basic HTML editor/basic file manager. Plain
> text interface HTML editor and basic functions file manager (new,
> delete, copy, move, new dir, rename) combined in one Perl program if
> anyone can please help me?!? Here's some more info...
>
> Ok I am on webtv. And my dad is also on webtv. Well you see, he needs a
> word processor but there are no "REAL" word processors out there
> available for webtv since you cannot download. People have attempted to
> create word processor type webpages but they really don't know what they
> are doing. Ok first of all the word processors already out there are
> just HTML editors. Now you see, one of these HTML Editor/Word processor
> sites has actually got something going...Except you cannot save. You
> just have to print. But my goal is to make a word processor on my web
> server for my dad to use. I know a little about Perl but I am no
> programmer. I merely know how to install scripts, ect. What I am wanting
> to do is find a very simple HTML editor/file manager and edit the
> interface of the editor and transform it into sort of a word processor.
> I will use scroll menus to insert the codes into the input box so even
> the non-technical type of person (my dad) can create a printable HTML
> document. Well that's the easy part but the hard part is finding a very
> simple perl script that will let me take the input and save it in a
> special directory, re-open documents that are saved, and manage the
> files...It's probably very easy for a programmer who knows Perl but for
> me it's a hard task. Please help! Any help would be very much
> appreciated!!
>
> Daniel
>
>
------------------------------
Date: Fri, 10 Aug 2001 00:16:59 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How do I pack arrays of doubles or floats for XS code?
Message-Id: <%JFc7.42$B2j.170752512@news.frii.net>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.
+
How do I pack arrays of doubles or floats for XS code?
The kgbpack.c code in the PGPLOT module on CPAN does just this. If
you're doing a lot of float or double processing, consider using the PDL
module from CPAN instead--it makes number-crunching easy.
-
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to
news:news.answers
or to the many thousands of other useful Usenet news groups.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-1999 Tom Christiansen and Nathan
Torkington. All rights reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
05.00
--
This space intentionally left blank
------------------------------
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 1480
***************************************