[24067] in Perl-Users-Digest
Perl-Users Digest, Issue: 6262 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 16 03:05:44 2004
Date: Tue, 16 Mar 2004 00:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 16 Mar 2004 Volume: 10 Number: 6262
Today's topics:
All capital permutations of a string? <joeblow341@hotmail.com>
Re: All capital permutations of a string? <bmb@ginger.libs.uga.edu>
Re: All capital permutations of a string? <xaonon@hotpop.com>
Re: All capital permutations of a string? <xaonon@hotpop.com>
Re: block of code doesn't get executed <jurgenex@hotmail.com>
Re: block of code doesn't get executed <dwall@fastmail.fm>
Hash slices and array references (David)
Re: How to remove lines containing "continuation" opera (werlax)
Re: login to a website problem in Perl (S Domadia)
login to website problem (S Domadia)
Re: problem passing args with system function <theaney@cablespeed.com>
Re: problem passing args with system function <sugargenius@houston.rr.com>
Re:ligious, Emacs v. vi <bernard.el-haginDODGE_THIS@lido-tech.net>
SOAP::Lite help with nested XML please <no@no.no>
Re: socket problem <sppNOSPAM@monaco377.com>
Re: Using IO::Socket::INET for grabbing web pages <Joe.Smith@inwap.com>
Re: variable initialization question <jwillmore@remove.adelphia.net>
Re: variable initialization question <jwillmore@remove.adelphia.net>
Re: variable initialization question <jwillmore@remove.adelphia.net>
Re: What is that tab char? <nospam@bigpond.com>
Re: What is that tab char? <jurgenex@hotmail.com>
Re: What is that tab char? <sbryce@scottbryce.com>
Re: What is that tab char? <kkeller-usenet@wombat.san-francisco.ca.us>
Re: What is that tab char? <jwillmore@remove.adelphia.net>
Re: Where did libC.a go to??? (at)FinancialDataCorp.com (Bob Mariotti)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 Mar 2004 02:47:21 GMT
From: Joe <joeblow341@hotmail.com>
Subject: All capital permutations of a string?
Message-Id: <40566ab9$0$41286$a1866201@newsreader.visi.com>
Does anyone have an elegant way of, given a string, generate all possible
capitalization permutations of that string? ie:
000 abc
001 abC
010 aBc
011 aBC
100 Abc
101 AbC
etc.
The only method I can come up with, which to me seems a little brute
force, is to create a
truth table, then compare each element of the array, stuffing the
corresponding element of the array with a lower or uppercase letter from
the corresponding element of the string. (0 would get lower, 1 upper).
Any one have any more interesting ideas? I don't need to keep the
permutations in memory, just create it and spit it out to STDOUT.
I was looking for a code snippet to create a truth table, but I was
surprised at not being able to find one. I would have thought "How do I
create a truth table and put it to STDOUT?" would have been a FAQ. Or I
wasn't using the right search terms.
Thanks for any help.
------------------------------
Date: Mon, 15 Mar 2004 22:50:03 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: All capital permutations of a string?
Message-Id: <Pine.A41.4.58.0403152242040.12180@ginger.libs.uga.edu>
On Mon, 16 Mar 2004, Joe wrote:
> Does anyone have an elegant way of, given a string, generate all possible
> capitalization permutations of that string? ie:
>
> 000 abc
> 001 abC
> 010 aBc
> 011 aBC
> 100 Abc
> 101 AbC
> etc.
Here's a hint at an answer:
perl -e 'printf "%03b\n", $_ for 0..2**3-1'
Here's an answer:
#!/usr/bin/perl
use strict;
use warnings;
my $s = lc shift;
my $l = length $s;
for( 0 .. 2**$l-1 ) {
my $i = 0;
for( split //, sprintf "%0${l}b", $_ ) {
my $ul = substr( $s, $i++, 1 );
print ($_ ? uc $ul: $ul );
}
print "\n";
}
No doubt there are more elegant ways ...
Regards,
Brad
------------------------------
Date: 16 Mar 2004 03:10:32 GMT
From: Xaonon <xaonon@hotpop.com>
Subject: Re: All capital permutations of a string?
Message-Id: <slrnc5crrh.aht.xaonon@xaonon.local>
Ned i bach <40566ab9$0$41286$a1866201@newsreader.visi.com>, Joe
<joeblow341@hotmail.com> teithant i thiw hin:
> Does anyone have an elegant way of, given a string, generate all possible
> capitalization permutations of that string?
> [...]
> Any one have any more interesting ideas? I don't need to keep the
> permutations in memory, just create it and spit it out to STDOUT.
Maybe you could do something with a Gray code, i.e. a bit string where each
member differs from the ones next to it by exactly one bit. You could start
with your string, and then just toggle the case of the appropriate character
on each pass. There's a bit at the very end of this paper:
http://compgeom.cs.uiuc.edu/~jeffe/teaching/373/notes/07-amortize.pdf
regarding how to find which bit to toggle. If that works, all you have to
do is keep the string (or a bit vector determining uppercaseness), an
integer array of the same length, and run this function on it 2^n - 1 times.
--
Xaonon, EAC Chief of Mad Scientists and informal BAAWA, aa #1821, Kibo #: 1
http://xaonon.dyndns.org/ Guaranteed content-free since 1999. No refunds.
"Xaonon is a sofa that sorts your mail, is built and maintained by tiny
nano-robots and induces lucid dreaming." -- thesurrealist.co.uk/priorart.cgi
------------------------------
Date: 16 Mar 2004 03:50:55 GMT
From: Xaonon <xaonon@hotpop.com>
Subject: Re: All capital permutations of a string?
Message-Id: <slrnc5cu78.aht.xaonon@xaonon.local>
Ned i bach <slrnc5crrh.aht.xaonon@xaonon.local>, im teithant i thiw hin:
> Ned i bach <40566ab9$0$41286$a1866201@newsreader.visi.com>, Joe
> <joeblow341@hotmail.com> teithant i thiw hin:
>
> > Does anyone have an elegant way of, given a string, generate all possible
> > capitalization permutations of that string?
> > [...]
> > Any one have any more interesting ideas? I don't need to keep the
> > permutations in memory, just create it and spit it out to STDOUT.
>
> Maybe you could do something with a Gray code, i.e. a bit string where each
> member differs from the ones next to it by exactly one bit. You could start
> with your string, and then just toggle the case of the appropriate character
> on each pass. There's a bit at the very end of this paper:
>
> http://compgeom.cs.uiuc.edu/~jeffe/teaching/373/notes/07-amortize.pdf
>
> regarding how to find which bit to toggle. If that works, all you have to
> do is keep the string (or a bit vector determining uppercaseness), an
> integer array of the same length, and run this function on it 2^n - 1 times.
Yeah, that seems to work. Try this:
#!/usr/bin/perl
use strict;
use warnings;
# EhrlichGrayIncrement
sub eg_inc( $\@\@ )
{
my ($n, $F, $G) = @_;
my $j = $$F[0];
$$F[0] = 0;
if( $j == $n )
{
$$G[ $n - 1 ] = 1 - $$G[ $n - 1 ];
}
else
{
$$G[ $j ] = 1 - $$G[ $j ];
$$F[ $j ] = $$F[ $j + 1 ];
$$F[ $j + 1 ] = $j + 1;
}
}
my $string = "abcd";
my $n = length $string;
my @chars = split '', $string;
my (@G, @F);
# EhrlichGrayInit
$G[$_] = 0 for 0 .. $n - 1;
$F[$_] = $_ for 0 .. $n;
for( 1 .. 2 ** $n )
{
# there's probably a better way to handle this part...
print $G[$_] ? uc $chars[$_] : lc $chars[$_] for 0 .. $n - 1;
print "\n";
eg_inc $n, @F, @G;
}
__END__
--
Xaonon, EAC Chief of Mad Scientists and informal BAAWA, aa #1821, Kibo #: 1
http://xaonon.dyndns.org/ Guaranteed content-free since 1999. No refunds.
"May all our thoughts be beautiful. May all our words be beautiful. May
all our actions be beautiful." -- The Yasa of the Sani
------------------------------
Date: Tue, 16 Mar 2004 02:09:44 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: block of code doesn't get executed
Message-Id: <Ilt5c.25747$F9.20448@nwrddc01.gnilink.net>
David K. Wall wrote:
> stalwart <hammer@thatbox.net> wrote:
[...]
>> s/^_RC//;
>> s/_RC^/"\n"/;
>
> A carat (^) in a regex means the beginning of a string. How can
> '_RC' be *before* the beginning of the string?
Almost right. A carat matches the beginning of the string iff it is at the
beginning of the RE. Otherwise it is just an ordinary character.
jue
------------------------------
Date: Tue, 16 Mar 2004 04:37:10 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: block of code doesn't get executed
Message-Id: <Xns94ADF0459760Bdkwwashere@216.168.3.30>
"Jürgen Exner" <jurgenex@hotmail.com> wrote:
> David K. Wall wrote:
>> stalwart <hammer@thatbox.net> wrote:
> [...]
>>> s/^_RC//;
>>> s/_RC^/"\n"/;
>>
>> A carat (^) in a regex means the beginning of a string. How can
>> '_RC' be *before* the beginning of the string?
>
> Almost right. A carat matches the beginning of the string iff it is at the
> beginning of the RE. Otherwise it is just an ordinary character.
D'oh! :-)
------------------------------
Date: 15 Mar 2004 21:22:11 -0800
From: davidol@hushmail.com (David)
Subject: Hash slices and array references
Message-Id: <3bef037b.0403152122.23ddf9c6@posting.google.com>
Dear all,
I pass an array of hashes by reference into a function and dereference
it like so:
my $ret_val = func ( \@table );
sub func {
my @table = @{ $_[0] };
...
...
}
I can then modify hash elements directly using a loop like this:
my $num = 0;
for (my $i = 0; $i < $#table; $i++) {
$table[$i]{seq_no} = ++$num;
...
...
}
Instead of using $table[$i]{seq_no} which seems a bit clumsy, I'd like
to extract the ith element from the array with %rec = %{ $table[$i] }
and then access (and modify) hash elements with a $rec{seq_no} =
++$num.
The problem is, when I try and assign something to $rec{seq_no}, the
array that I've passed in (by reference) doesn't actually change.
Can I modify %rec = %{ $table[$i] } so that the assignment
$rec{seq_no} = ++$num directly modifies the array?
Cheers,
David
------------------------------
Date: 15 Mar 2004 19:28:35 -0800
From: werlax@hotmail.com (werlax)
Subject: Re: How to remove lines containing "continuation" operator
Message-Id: <744cd116.0403151928.2348c722@posting.google.com>
charley@pulsenet.com (Chris Charley) wrote in message news:<4f7ed6d.0403151500.64d48cb7@posting.google.com>...
> [snip]
>
> perldoc perlrun
>
> Will explain it. Scroll down to the '-i' command switch.
>
>
Your '[snip]' removed the portion where I said "From reading
the manpage I thought it was supposed to automatically use the
original filename as the default for print commands?" but I will read
through it again to see if I missed something. I'm trying this for
the first time and am missing something. Maybe RTFM again will help.
Thanks.
------------------------------
Date: 15 Mar 2004 22:41:43 -0800
From: sangita_sjtr@yahoo.co.in (S Domadia)
Subject: Re: login to a website problem in Perl
Message-Id: <4c5b8d9e.0403152241.1c522184@posting.google.com>
hi
i updated my mail text as you told .
thanks sangita.
sangita_sjtr@yahoo.co.in (S Domadia) wrote in message news:<4c5b8d9e.0403110236.4bb06dc4@posting.google.com>...
> Hi,
> i am developing an application using perl which connects to a website
> then login to that site using some username and password.But i am
> facing problem as i am not able to login because after login method is
> called it's not able to call post method as a response.I tried many
> things to make my code working but no one is working.
> please help me if you have some idea about it.My application is using
> WWW::mechanize package to connect to website if you know any other
> better package to connect and login to website please do inform me.
> My code is like this:
>
> use WWW::Mechanize;
> use HTML::TokeParser;
> use diagnostics;
>
> my $browser = WWW::Mechanize->new;
>
> $url="http://www.websitename.com"; # i am using www.investors.com as
> a websitename
> $user="username";
> $pass="password";
> $resp1=$browser->get($url);
> print "looking at: ", $browser->uri, "\n";
>
> #print $resp1->content;
> # print $browser->res->content;
> #
> $browser->form("forLogIn");
>
> $browser->set_fields(
> "htmUserName" => $user,
> "htmPassword" => $pass,
>
> );
>
> $browser->click();
> print "looking at: ", $browser->uri, "\n";
>
> print $browser->res->content;
> open STDOUT,">>ibd.html" or die "can't open$!";
>
>
> thanks for any suggestions you can provide.
> s domadia.
------------------------------
Date: 15 Mar 2004 22:24:04 -0800
From: sangita_sjtr@yahoo.co.in (S Domadia)
Subject: login to website problem
Message-Id: <4c5b8d9e.0403152224.61102062@posting.google.com>
Hi,
i am developing an application using perl which connects to a website
then login to that site using some username and password.But i am
facing problem as i am not able to login b'coz after login method is
called it's not able to call post method as a response.I tried many
things to make my code working but no one is working.
please help me if you have some idea about it.My application is using
WWW::mechanize package to connect to website if you know any other
better package to connect and login to website please do inform me.
My code is like this:
use WWW::Mechanize;
use HTML::TokeParser;
use diagnostics;
my $browser = WWW::Mechanize->new;
$url="http://www.websitename.com";#Iam using www.investors.com as a
websitename
$user="username";
$pass="password";
$resp1=$browser->get($url);
print "looking at: ", $browser->uri, "\n";
#print $resp1->content;
# print $browser->res->content;
#
$browser->form("forLogIn");
$browser->set_fields(
"htmUserName" => $user,
"htmPassword" => $pass,
);
$browser->click();
print "looking at: ", $browser->uri, "\n";
print $browser->res->content;
open STDOUT,">>ibd.html" or die "can't open$!";
thanking you
sangita.
------------------------------
Date: Mon, 15 Mar 2004 21:08:04 -0500
From: Tim Heaney <theaney@cablespeed.com>
Subject: Re: problem passing args with system function
Message-Id: <874qsp4k8r.fsf@mrbun.watterson>
Woody <sugargenius@houston.rr.com> writes:
>
> Why is wget not getting the url?
You need to use double quotes to interpolate the variable
system "wget -bc $url";
I hope this helps,
Tim
------------------------------
Date: Tue, 16 Mar 2004 03:26:33 GMT
From: Woody <sugargenius@houston.rr.com>
Subject: Re: problem passing args with system function
Message-Id: <Xns94ADDA19ADB18sugargeniushoustonrr@24.93.44.119>
Tim Heaney <theaney@cablespeed.com> wrote in
news:874qsp4k8r.fsf@mrbun.watterson:
> Woody <sugargenius@houston.rr.com> writes:
>>
>> Why is wget not getting the url?
>
> You need to use double quotes to interpolate the variable
>
> system "wget -bc $url";
>
> I hope this helps,
>
> Tim
>
Thanks, Tim. That did it.
------------------------------
Date: Tue, 16 Mar 2004 08:50:33 +0100
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re:ligious, Emacs v. vi
Message-Id: <Xns94AE59442E84Delhber1lidotechnet@62.89.127.66>
Ben Morrow <usenet@morrow.me.uk> wrote:
[...]
> Things I miss from emacs are its intelligent indent mode, which is
> rather cleverer than vim's (though the flip side of this is that
> vim mucks up your indenting by mistake much less often); and the
> fact that emacs won't let you delete something without copying it
> to the kill ring. It is of course possible that both of these are
> due to my unfamiliarity with vim... :)
They most certainly are. :-)
--
Cheers,
Bernard
------------------------------
Date: Mon, 15 Mar 2004 20:37:09 -0600
From: ItNerd <no@no.no>
Subject: SOAP::Lite help with nested XML please
Message-Id: <105cq2ocr1d5f5@news.supernews.com>
use SOAP::Lite +autodispatch =>
uri => 'http://www.allconsuming.net/AllConsumingAPI',
proxy => 'http://www.allconsuming.net/soap.cgi';
my $AllConsumingObject = AllConsumingAPI->new ();
my $BookFile = $AllConsumingObject->GetWeeklyList();
print "Content-type: text/html\n\n";
foreach my $item (@{$BookFile->{'asins'}}) {
print "<font size=2
face='arial'><b>$item->{'asin'}></b><br>$item->{'title'}</font><p>";
}
.....................
For the above code, I will be accessing a nested xml feed as in this link:
http://www.allconsuming.net/rest.cgi?action=GetWeeklyList
How do I get the next level of 'urls'? I can get the //asins to print
out, but my foreach doesn't seem to work right for the next level inward
to the urls list.
Thanks in advance.
------------------------------
Date: Tue, 16 Mar 2004 08:37:44 +0100
From: =?ISO-8859-15?Q?S=E9bastien?= Cottalorda <sppNOSPAM@monaco377.com>
Subject: Re: socket problem
Message-Id: <4056aec9$0$301$626a14ce@news.free.fr>
Thomas Kratz wrote:
> Sébastien Cottalorda wrote:
>
> [snipped]
>
>> unless ($socket = IO::Socket::INET->new(PeerAddr=> 'aaa.bbb.ccc.ddd',
>> PeerPort=> '21110',
>> Proto=> "tcp",
>> Timeout=>10,
>> Type=> SOCK_STREAM))
>> {
>> print ("Unable to connect \n");
>> exit 1;
>> }
>> my $s=IO::Select->new();
>> $s->add($socket);
>> while(1){
>> if ($s->can_write(10)){ # ===>>> OK even if the socket is closed
>> unless ($socket->send('@025123459876556789L@@')){
>> #====>CRASH-->bash
>> print "Unable to write\n";
>> last;
>> }
>> print "sent\n";
>
> you could check with $socket->connected() whether the socket is still
> valid or check with $s->has_exception() whether there are sockets that
> have those.
>
> Thomas
>
That solved my problem.
Thanks a lot Thomas.
Sébastien
--
[ retirer NOSPAM pour répondre directement
remove NOSPAM to reply directly ]
------------------------------
Date: Tue, 16 Mar 2004 05:52:57 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Using IO::Socket::INET for grabbing web pages
Message-Id: <YCw5c.19358$_w.416369@attbi_s53>
David Morel wrote:
> I need to grab web pages from the internet using IO::Socket::INET.
> What is the code for doing so?
You can find the code in the modules that LWP::Simple uses.
> I know that there are easier ways to grab pages,
> such as by using LWP::Simple --
> my $html = get($url);
>
> However, I really need to use IO::Socket:INET.
Why? LWP::Simple uses IO::Socket::INET already.
perl -MLWP::Simple -e 'get "http://www.inwap.com/"; print
"$_=$INC{$_}\n" for sort keys %INC;'
Carp.pm=/usr/lib/perl5/5.8.3/Carp.pm
Config.pm=/usr/lib/perl5/5.8.3/i586-linux/Config.pm
Errno.pm=/usr/lib/perl5/5.8.3/i586-linux/Errno.pm
Exporter.pm=/usr/lib/perl5/5.8.3/Exporter.pm
Exporter/Heavy.pm=/usr/lib/perl5/5.8.3/Exporter/Heavy.pm
HTTP/Status.pm=/usr/lib/perl5/site_perl/5.8.3/HTTP/Status.pm
IO.pm=/usr/lib/perl5/5.8.3/i586-linux/IO.pm
IO/Handle.pm=/usr/lib/perl5/5.8.3/i586-linux/IO/Handle.pm
IO/Socket.pm=/usr/lib/perl5/5.8.3/i586-linux/IO/Socket.pm
IO/Socket/INET.pm=/usr/lib/perl5/5.8.3/IO/Socket/INET.pm
IO/Socket/UNIX.pm=/usr/lib/perl5/5.8.3/IO/Socket/UNIX.pm
LWP/Simple.pm=/usr/lib/perl5/site_perl/5.8.3/LWP/Simple.pm
SelectSaver.pm=/usr/lib/perl5/5.8.3/SelectSaver.pm
Socket.pm=/usr/lib/perl5/5.8.3/i586-linux/Socket.pm
Symbol.pm=/usr/lib/perl5/5.8.3/Symbol.pm
XSLoader.pm=/usr/lib/perl5/5.8.3/i586-linux/XSLoader.pm
strict.pm=/usr/lib/perl5/5.8.3/strict.pm
vars.pm=/usr/lib/perl5/5.8.3/vars.pm
warnings.pm=/usr/lib/perl5/5.8.3/warnings.pm
warnings/register.pm=/usr/lib/perl5/5.8.3/warnings/register.pm
Are you, perhaps, basing your assumptions on old versions of
these modules?
-Joe
------------------------------
Date: Tue, 16 Mar 2004 01:20:11 -0500
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: variable initialization question
Message-Id: <pan.2004.03.16.06.20.09.623055@remove.adelphia.net>
On Mon, 15 Mar 2004 12:05:39 -0500, Paul Lalli wrote:
> my $accum;
>
> while (...) {
> if (...) {
> $accum++;
> }
> if (...) {
> $accum--;
> }
> }
>
> if (defined ($accum)){
> print "Finshed with $accum accumulated widgets\n";
> } else {
> print "No widget was ever accumulated\n";
> }
>
> If on the other hand, we had originally initialized $accum to 0, we have
> no way of telling whether we ever saw any acuumulated widgets and later
> saw an equal number of subtractions, or if no widgets were ever
> accumulated.
In the code above, I would have initialized $accum to '0'. I want to know
the count represented by $accum. Had I wanted to know if matches were
made, I would write the code differently - because I was looking for
matches, not a count. Without any specifics, one could see it anyway they
wanted to. So, your example .... doesn't real show much, IMHO :-)
> Basically the undef value means "This variable has never been touched"
> where as assigning a default value carries the meaning of "this variable
> has been deliberately assigned to this specific value". The distinction
> can be quite important in any number of programs.
I see what you were trying to represent, but the example doesn't show
that, IMHO.
How about ....
my $match;
$match = $1 if $string =~ m/^foo (.*)/;
print "No match\n" unless defined $match;
Now I can see what you were getting at :-)
> To those who suggest variables should be defined to help readers of the
> program know what's going on, I suggest those readers learn Perl better,
> rather than need to be hand held through needless code.
Well, that's rather insulting. But, that's just my read on your comments
above.
I'm also seeing the difference in the statements that started all this -
that there are times that you don't want to initialize a value to
something - that 'undef' is more desirable. And that I mis-understood the
postings in general. I thought 'declare' (meaning, under strictures, you
*must* declare variables up front in order to use them) when 'initialize'
(meaning, declare the variable *and* set it to a value up front) was used.
But hey, it won't be the last time :-)
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
"I'd love to go out with you, but I'm staying home to work on my
cottage cheese sculpture."
------------------------------
Date: Tue, 16 Mar 2004 01:41:35 -0500
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: variable initialization question
Message-Id: <pan.2004.03.16.06.41.33.634631@remove.adelphia.net>
On Mon, 15 Mar 2004 17:49:46 +0000, Anno Siegel wrote:
> Tore Aursand <tore@aursand.no> wrote in comp.lang.perl.misc:
>> On Mon, 15 Mar 2004 11:06:28 +0000, Anno Siegel wrote:
>> >>> There's generally no reason to initialize a variable to 0.
>>
>> >> Unless you like clean programs.
>>
>> > You're not recommending to initialize *all* variables, are you?
>>
>> Why not, actually? I really _like_ the idea of having each variable in a
>> program initialized before use. What are the arguments against doing
>> this?
> Unlike other languages, Perl variables *are* initialized. Despite its
> name, undef is a well defined value with a well defined function, and
> every scalar comes initialized to it. Nothing more dangerous than a
> friendly warning happens if you use the value inappropriately. By
> overwriting it you tell the reader, "Undef isn't good enough, I need
> something else." Don't tell them that if it isn't true.
Maybe I mis-understood what the point of your posts were... and if so,
sorry for the grief. I agree that "declaring" variables up front is good,
"initializing" them to some value can be good, but undesired in *all*
cases. Did I get it?
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
"They told me I was gullible ... and I believed them!"
------------------------------
Date: Tue, 16 Mar 2004 01:43:32 -0500
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: variable initialization question
Message-Id: <pan.2004.03.16.06.43.28.809550@remove.adelphia.net>
On Mon, 15 Mar 2004 12:51:06 -0500, Richard Morse wrote:
> Note that Mr. Seigel wrote "initialize a variable to 0" -- not
> "initialize a variable". Perl handles the initialization of variables
> to undef automatically.
I mis-understood the post. Thanks for pointing that out.
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
Murphy's Law is recursive. Washing your car to make it rain doesn't work.
------------------------------
Date: Tue, 16 Mar 2004 12:05:47 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: What is that tab char?
Message-Id: <2083452.SDupLJT52D@GMT-hosting-and-pickle-farming>
Jill wrote:
> When I create a tab delimited file form perl it is fine and I use the /t
> char to designate a tab.
> the code in the web page works fine and I can import into my excel
> spreadsheet.
Web browsers ignore ascii tab, page break, etc.
Use tables or ccs instead.
gtoomey
------------------------------
Date: Tue, 16 Mar 2004 02:19:40 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: What is that tab char?
Message-Id: <0vt5c.25758$F9.1795@nwrddc01.gnilink.net>
Jill wrote:
> When I create a tab delimited file form perl it is fine and I use the
> /t char to designate a tab.
> the code in the web page works fine and I can import into my excel
> spreadsheet.
>
> I am trying to do the same with html code.
> how can I create the same ascii char or control char by using just
> html.
HTML doesn't "create" anything simply because HMTL is not a programming
language.
And of course you can use TAB in HTML, although chances are that a TAB in
HTML doesn't do the same thing as a TAB does in a text editor or a TTY. You
are comparing apples and oranges.
> I am trying to make a table for users to download using tab delimited
> import.
> Now why can the perl achieve this and not the html?
> for example when i run the perl, I just do file-save as and choose
> txt in IE6, and all is well.
>
> if not, can javascript do this? what about php.
> I can embed that perhaps.
First of all you should think very carefully about what you mean by "that".
Creating a comma-separated file? Well, no chance with HTML simply because
HTML is not a programming language.
Presenting some table to a user? Sure, not problem in either, but you have
to use the methods of the proper language, e.g. in HTML you have to use the
<table> tag while in a file or text editor or console you can get away with
using a plain TAB.
Now, what is your Perl question again?
jue
------------------------------
Date: Mon, 15 Mar 2004 19:21:45 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: What is that tab char?
Message-Id: <105cp5kln2s588f@corp.supernews.com>
Jill wrote:
> I am trying to do the same with html code.
> how can I create the same ascii char or control char by using just html.
This is a Perl newsgroup, not an HTML newsgroup. Perhaps you will get a
better answer in an HTML newsgroup.
HTML generally reduces all contiguous white space down to a single
space. You probably want to investigate the <table> tag or the <pre>
tag. It depends on what you are trying to accomplish.
------------------------------
Date: Mon, 15 Mar 2004 20:19:25 -0800
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: What is that tab char?
Message-Id: <d8v53c.sqo.ln@goaway.wombat.san-francisco.ca.us>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
On 2004-03-16, Jill <jillfr@hotmail.com> wrote:
> I am trying to do the same with html code.
> how can I create the same ascii char or control char by using just html.
Shouldn't you be asking this question in an HTML newsgroup?
- --keith
- --
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQFAVoBIhVcNCxZ5ID8RAl0ZAJ47hhkuJgJ1QxOi6L8JPgiBGlk35ACgmZoz
GGyznYUk/vsFWaCQXRug4q0=
=kD0K
-----END PGP SIGNATURE-----
------------------------------
Date: Tue, 16 Mar 2004 01:01:10 -0500
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: What is that tab char?
Message-Id: <pan.2004.03.16.06.01.07.559001@remove.adelphia.net>
On Tue, 16 Mar 2004 00:31:11 +0000, Jill wrote:
> Now why can the perl achieve this and not the html?
HTML doesn't know about tabs in the same way as an ASCII file. If you
want to represent non-breaking spaces, then use ' '. If you want to
represent a table in HTML, then you need to use the '<table>', '<tr>',
'<td>' tags. You should learn HTML and know that HTML is a markup
language and Perl is not.
Does that make sense or I have I lost you?
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
Warp 7 -- It's a law we can live with.
------------------------------
Date: Tue, 16 Mar 2004 03:11:50 GMT
From: R.Mariotti(at)FinancialDataCorp.com (Bob Mariotti)
Subject: Re: Where did libC.a go to???
Message-Id: <40567053.26108318@news.cshore.com>
Resolved it myself!
Believe it or not, the stub of IBM's xlC compiler MUST be installed
for perl to function. Go figure.
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 6262
***************************************