On Sep 28, 2009, at 11:01 AM, Ruprecht Helms wrote:
Hi,
How have I to write the sql-statement if I want to use variables
like this:
Don't.http://xkcd.com/327/
The value of the variable can have the value of another recordsetloop
or a value come from outsite the script.
Regards,
On Mar 29, 2010, at 10:54 AM, r...@i.frys.com wrote:
I looked through perlop and was unable to find where it
stated that the ternary operator should only be used in an
assignment such as you've shown. Can you point out where
that's located.
In my reasonably-arrogant opinion: That's kind of
sanket vaidya wrote:
>Whereas the output on perl 5.6.1 is
>
>Hello!!1
Ummm, beg to differ
#!/usr/bin/perl
use strict;
use warnings;
sub hello;
my $ref = \&hello;
&{$ref};
sub hello {
print "hello!!";
}
[EMAIL PROTECTED]:~$ perl -l pbml.pl
hello!!
[EMAIL PROTECTED]:~$ perl -v
This is
If you're using Gnu diff (i.e. the diff that comes with most Linuces)
--speed-large-files might help you, without having to jump through a
perl hoop.
--L
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
> I am using a module having documentation saying document() is a
> method. However, I see it used as
>
> $o->document;
>
> Can you reference a method in this way? (I takes no args). I always
> thought
>
> $o->document() and $o->document meant different things, function
> verses attribute.
>
> This distinction between canonical existence and logical existence--or
> perhaps more properly the distinction between the existence of an
> element and of a position--is important because, while useful, the
> distinction does have implications for the value of $#array, the
> return value of scal
>
> I was just trying to match a string and save it in a single statement
> as follows:
>
> $extracted = "cp xyz";
> $state_var = $extracted =~ m/cp\s+(.*)/;
> print "$state_var $1 \n";
>
> The output is: 1 xyz
>
> So the assignment to $state_var does not work. Is this an incorrect way.
>
The
On Tue, 30 Nov 2004 23:33:39 +, Jonathan Paton <[EMAIL PROTECTED]> wrote:
> Dave,
>
> Yes, look up references in your books.
>
> E.g.
>
> sub example {
> my @data = qw;
> return [EMAIL PROTECTED];
> }
>
> my $reference = example();
>
> for my $word (@{ $reference }) {
> print "
John Krahn wrote:
> Debbie Cooper wrote:
> > my @empty = ();
> > my @headings = ();
>
> Aggregate variables created with my() are empty by default so assigning an
> empty list to them is redundant.
>
I hope I am not opening a can of worms by getting into a style
disucssion, and I will preface t
> > Sure...if I know someone can do the job. I'll just go to rentacoder.com
>
> I'd be more than happy to consult for your Perl needs, send me an email
> off list if you're interested.
>
> >>If not, "steal it from the market" might be more apt.
> >
> >
> > So you don't take examples you find o
>
> Got it so far.
>
> open CHECKFILE, "< file.in" or die qq(Cannot open file "file.in": $!);
> @filecontent = ;
> foreach $line (@filecontent) {
> print " $line";
> }
> close (INFILE);
>
>
> The input file (list of files) looks something like this:
>
> P: 1
::Magick provides a Perl implementation that will call
ghostscript for you.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions.
$phrase = 'Anna would like a banana';
my ($greedy) = $phrase =~ /(.*)na/;
my ($nongreedy) = $phrase =~ /(.*?)na/;
print "Greedy: $greedy \nNongreedy: $nongreedy \n";
produces the output
Greedy: Anna would like a bana
Nongreedy: An
-- -- -- -- -- -- -- -- -- -- -- -
ords (and THAT , class, is why embedded blanks in hash keys for
positional parameters is a Bad Idea - because you can't use qw//)
So, if instead of two parameters I had to pass a handful of
parameters:
some_graphic_function ( @opt{ qw / x_position y_position
radius line_style color depth /
> Casey West wrote:
> > It was Wednesday, December 01, 2004 when Gunnar Hjalmarsson took the
> > soap box, saying:
> >> Casey West wrote:
> >>> The original question was places squarely within reasonable query
> >>> boundaries.
> >>
> >> What do you refer to as "the original question"? To me it's
on is
required or warranted.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
set binary mode.
$ftp->binary || die "Could not set binary mode", $ftp->message;
warn "Bin mode set ... " ;
#
# Now we are ready to get the file we want
#
$ftp->get('random_file.jpg') || die "Get failed ", $ftp->message;
warn "Get c
rs later.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.
--
To unsubscribe, e-mail
>
> Is it something like:
>
[snippage snipped]
>
> TIA!
>
>
> Regards,
>
Not a hash reference, a hash ...
sub method
{
my ($class, %opt) = @_ ;
.
.
.
}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL
*IS* much faster, but
always leaves me with the feeling that it's overly obfuscated.
(Although maybe if I forced myself to use it more often I'd be more
comfortable with it... )
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/a
n empty string if there is no cookie
$ID = $newcook{usrID}->value if ref($newcook{usrID});
# if there is no cookie, $ID will be untouched (maybe undef?)
$ID = ( ref($newcook{usrID} ? $newcook{usrID}->value : 'no cookie set yet' );
# $ID will get *SOME* value you can change
k and friends, or even taking the
bigger step and start throwing exceptions.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.
--
I bring this up: You're going to spend
a lot of effort to debug your cookie problem, perhaps to find later
that some large segement of your population doesn't permit cookies).
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s
*
another corner of Perl to explore, even if you've been living there
for a long time.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal propo
he line
if ( my ($key, $value) = /(.*): (.*)$/) {
warn "Got $value for $key";
push @{$data{$key}}, $value;
}
}
warn Dumper \%data;
__DATA__
key1: data1a
key2: data2a
key3: data3a
key1: data1b
key2: data2b
key3: data3b
.END PERL PROGRAM ..
e) ", sprintf("%o",
$mode),"\n" ;
... END PERL PROGRAM .......
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components:
d work:
print join("\t", @key ),"\n";
my $stop;
until ( $stop ) {
$stop = 1;
foreach my $key ( @key ) {
print shift @{$data{$key}} || '', "\t";
undef $stop if @{$data{$key}};
}
print "\n";
}
I've had too many
a previous
read or write operation, the OS may post an error when you attempt to
close. Another possibility (although far-fetched): What if the
filesystem goes away while you had it open?
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTEC
.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.
--
To unsubscribe, e-mail: [EMAIL PROTECTED
Green Yellow Blue Rojo Verde Amarillo Azul
Red Green Yellow Blue Rojo Verde Amarillo Azul
Red Green Yellow Blue
Red Green Yellow Blue Rojo Verde Amarillo Azul
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software
Why don't you try trimming everything out except the block that
encloses line 382 and post that.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zero
> Okay, now I have to admit I'm also new to Perl, but I can adapt to change:
>
> /^.*\.[tj][pi][gfe].{0,1}$/i
>
> I threw in the quantifier to avoid what Felix exposed. Now, there's
> probably a hole in this somewhere, but it's got to be a small one...
>
> -Paul
>
Zeroth: It would better
($var)) {
> print "your variable is a number $var\n";
> } else {
> print "number $var is not a number\n";
> }
1) Read perldoc Net::IPv4Addr
2) change ipv4_checkip to ipv4_chkip
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
use) or (b) explicitly
pass it to make.
make CC=/opt/bin/gcc
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.
--
To uns
"
My gut (and many years of experience) tells me "putting a big fat
database select in the middle of your route selection code is going to
be a performance pig". Caching, caching, caching.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence
Aww, dangit --- I should have not used __TARGET__ as the replacement
tag -- there is just too much room for confusion with reserved words
like __PACKAGE__ or __LINE__ ... Everyone take out your erasers and
change that to --TARGET-- please :)
--L
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
#x27;name' => 'cookie',
'path' => '/'
}, 'CGI::Cookie' );
And, it got promoted into a cookie pretty well ...
cookie=USER_CATEGORIES&HASH%280x12afe8%29&LEVEL&exulted&USER_GROUPS&ARRAY%280x21d24c%2
demand
for open-source source-closing software.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.
--
To unsubscribe, e-mail: [EMAIL PRO
again.
Footnotes:
[1] I actually think cookie paranoia is misplaced, and would love to
see users educated -- but The Client Is Always Right, and if they say
"Our industry demands no cookies" then so be it. There are other ways
of keeping state, use them when you must.
-- -- -- --
ld thinks pearl is something that grows inside an
oyster and just want to have a dot-exe file they can download and run.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two component
n"
if $log{$key}{user_type} eq 'robot';
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
s
... END PERL CODE .
Produces the follwoing output:
lawrence /tmp > perl ./jm.pl
192.168.1.1 "...GoogleBot..."
192.168.1.3 "...Linux...Firefox..."
192.168.1.5 "...Windows...MSIE..."
Another place that could be giving you grief is trying to embed
it...?
Your homework: Starting with that structure above, write a subroutine
that will iterate across it producing the following output:
Hint - it will definitely be easier to explicitly break the structure
into lists and hashes at first. Then squeeze your code to eliminate
the intermediat
is a bad idea.
One of the unspeakable horrors that was thrust upon me in my current
job, was a chunk of 7,467 lines of code that is one enormous
if/elsif/elsif/elsif/elsif/ block. Now it is 287 subs and a %dispatch
table.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
rom_ is either your match or undef
Which just allows you to defer the test for undef until later.
print "I saw an email address $from_\n" if defined($from_);
I just wrote about this a mere two weeks ago in this very forum.
http://www.nntp.perl.org/group/perl.beginners/70671
-- -- -- --
6:20: ocidfn.h: No such file or directory
Well -- find those files... maybe your sysadmin installed Oracle's
libraries in some non-standard place
find / -name oci.h
Then, fixup the incdir path, and try again.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence S
ut without ill
effect) that allows me to SUPPRESS that automatic check is a GOOD
thing. But requiring me to know that my $DISPLAY is set but
unreachable is a stone in my shoe.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
C
) );
if ( my $cursor = $sth->execute ) {
while (my $row = $sth->fetchrow_hashref) {
.
.
.
}
}
Of course, this just trades the KNOWN quantity of "straightforward
memory for time" for a relatively unknown tradeoff on the database
server.
-- -- -- -- -- -- --
;
Class methods have uppercase forms: Employee->Create();
Functions/methods that return a list have plural noun forms:
$division->Employees; $person->email_addresses.
Well -- enough philosophy for one day ...
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
ed `X'\n";
}
... END PERL PROGRAM ...
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is t
rence (@preference) {
print $preference->{language},"\n";
}
--- end perl code ---
Plugging this into a CGI and doing something useful with it is, as
they say, left as an exercise to the reader.
-- -- -- -- -- -- -- -- -- --
cal variables is a good thing, but you don't just litter
your code with 'my' -- you have to declare each variable once in the
narrowest usable scope ...
my @group = qw / Fred Mary Lawrence Georgia / ;
my @newgroup = @group;
my $switch = ...whever this comes from...
if ( 0 == $switch
rogram does nothing useful";
--
... put it into your crontab and see what happens.
Reading the man page for your system's cron will also be enlightening.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software
a single
.EXE file they can just run, without having to install Perl.
The comes-with perlcc will function for those cases where "I just want
to save myself the support hassle of casual users tweaking the
script."
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
L
ut its consistently faster by an average 6-10%
>
> Any ideas why that might be?
Well, first -- you're creating the hash inside the benchmark loop,
which is not particularly light-weight.
Second: You're using pathologically small lists. Try running it with
10,000 elements
ash version was about 10 times faster
for *JUST THE SELECTION OPERATION* than the grep-the-list version.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them
-long and randomly-variable amount of
time (printing) inside the function you are trying to test, you are
basically destroying the exact number you are trying to compute, and
have merely computed the deviation of the print operator.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
sort keys %capdef ) {
}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For addit
> Hi,
> can anybody address me to online resources to learn how to connect to a
> PostgreSQL DB server through a Perl script?
> Code examples are welcome ;-)
> TIA
>
- begin perl code ---
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
our $_db
t;
> Thnx in advance
Yes. The cause of this is the script headers are ending prematurely.
If you would rather have *USEFUL* answers to stupid questions,
including some code to elicit the error would be reccomended.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
ere who
configure their browsers to either not issue referrer at all, or
tomangle it in an effort to obfuscate their activities.
My instinct tells me: If the CGI::referrer() call is not giving you
what you want, then it's unlikely that the browser is correctly
passing in the header.
-- -- -- -- --
ne record because it has the "0" value.
> How could I pass this situation?
>
while ( defined ( my ($pid) = $sth->fetchrow_array ) ) {
}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software c
series of data
indexed by a monotonically increasing integer. The List.
my @keyword = split ( /\//, 'something/wicked/this/way/comes' ) ;
If you like the refence version of it
my $keywords = [ split (/\//, 'something/wicked/this/way/comes') ] ;
-- -- -- -- -- -- -- -- -- -- --
> --_=_NextPart_001_01C524BC.E5934C9B
> Content-Type: text/plain;
> charset="us-ascii"
> Content-Transfer-Encoding: quoted-printable
>
> Hi all,
> =20
> I am trying to evaluate a string, and determine if the last charater of
> the string has a backslash '\' . The piece of code I am usin
y listen on a given
address.
Getting the IP-addresses for the various interfaces on your system is
left as an exercise to the user.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two comp
5.456')))
|| die "bind: $!";
between the calls to socket() and connect().
Obviously you'll need to replace that bogus IP-addr with the ip-addr
of your local interface.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s
ides a helper function
POST that will generate a properly formated HTTP::Request object.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into th
) would give me
> better mileage.
>
I use PDF::API2 every day and love it.
The documentation is horribly lacking (Track down the example files -
that is the best doco there is), but the library can do it all.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
amp;& $value eq 'spring' ) {
print "Flowers are in bloom\n";
} else {
print "No flowers here!\n";
}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal
dsheet::WriteExcel
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.
--
To unsubscribe, e-mail
t -e script
client 15173
I can even get more clever
lawrence /home/export/lawrence > alias wonko-summary 'perl -I/tmp/libperl
-MWonko=script -e script'
Now I can do
lawrence /home/export/lawrence > wonko-summary client 15173
Total invoiced: 372.56 Aged 30 days: 144.31 Aged 6
> I was looking at the example code in the mysql examples directory. They seem
> to have been created for testing things like very large records.
>
> Does anyone have a minimal example that executes a SQL SELECT command and
> displays the results?
>
> I need something really simple to get me star
self->{foo}
is *INSIDE* the defining class.
And even there, you *USUALLY* should not. Notice in my little
example, I used $self->customer_number.
Even though I was "inside" the class for configuration, and I "know"
that customer_number is an attribute of the object, i
...
Footnotes:
[1]: This, along with create world peace is left as an exercise for
the reader.
[2]: One of the things that really loses with English is the fact that
there are many collisions between verb, noun, and adjective
24 } } ;
foreach my $key (sort { $serverdata->{$a}{hour} <=> $serverdata->{$b}{hour} }
keys %$serverdata) {
... do something with $serverdata->{$key} ...
}
>
> Thanks
>
De nada.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawr
7; => [
#{
# 'amount' => '100.00',
# 'pay_date' => '3rd May 2005',
# 'supplier' => 'supplierC',
#
rving Perl
programmers.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.
--
To unsubscribe, e-mail:
> Hi list,
>
> Hope this is not too simple or a stupid question:
>
> I have a slight problem with a loop. It is a simple numbers guessing game. It
> works fine, but when I run this script, it gives me "Too low" immediately aft
> er
> the prompt. What should I do to get the last "else" statement d
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> our ($upper, $lower, $target) = ( 20, 1, 11 );
>
D'oh! I really _meant_ to make those lexical instead of package
variables - another good habit to get in early.
my ($upper, $lower, $target) = (20,1,11);
--
To unsubscribe, e-mail: [EMAIL
> > Get in the habit of using strict and warnings -- 'use warnings' is
> > subtly different from 'perl -w' and you should start good habits
> > early. Upgrade if you are using an ancient version of Perl that does
> > not come with warnings.
> >
> So would it be a conflict to use both "-w" and "st
e call - so it does increase
the total knowledge of your program.
My hitherto prefered answer is "It should return the object." Only
because I (used to) like to chain method calls. I've since lost this
bad habit.
$fruit->name('apple')->color('red
ipts have logic to push the same directory to @INC. It's
> rather repetative.
>
You do not need logic to do that. It would seem better to use:
use lib '/path/to/my/misplaced/perl-modules';
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawre
;color('red');
> $_->texture('crunchy')
> }
>
Hrm ... a Clever Construction, indeed. Our local style guide bans the
use of for without an explicit index variable , so that bit of
cleverness would lead to the following silly code:
for my $localfruit ($fruit) {
$localfr
Charles Clarkson wrote:
> @{ %$hash_ref }{ keys %kv_pairs } = values %kv_pairs;
You can excise a little of the snyactic sugar there
@$hash_ref{keys %kv_pairs} = values %kv_pairs;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTEC
On 11/22/2010 09:02 AM, shawn wilson wrote:
any of y'all write web apps in perl? what do you use? i'm using
html::template but i was thinking of going back to straight cgi.pm or having
my perl send back json for the page to render (but i'm not that familiar
with js). thoughts?
Your major unwri
On 04/12/2011 08:26 AM, marcos rebelo wrote:
Hi all
I have a code like:
foreach my $key ( ... ) {
my $sub = "get_$key";
$self->$sub;
...
}
If I can do this, I can also do it without the variable $sub.
What is the syntax? please
Best Regards
Marcos Rebelo
#!/usr/bin/perl
use str
On 05/05/2011 10:53 AM, apm wrote:
I have old legacy code on .net 1.1 c#
Byte[] clearBytes = new
UnicodeEncoding().GetBytes(cleanString);
Byte[] hashedBytes = ((HashAlgorithm)
CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);
return BitConverter
On 09/16/2011 06:10 PM, Rajeev Prasad wrote:
why do i need a web app? becuase of size of my project? I mean if it is going
to be a very big website with lot of pages and tables etc. should i have a
webapp?
apache and cgi wont cut it? (alongwith other technologies used commonly in websites)
On 09/17/2011 08:51 PM, Rob Dixon wrote:
On 17/09/2011 20:10, Lawrence Statton wrote:
On 09/16/2011 06:10 PM, Rajeev Prasad wrote:
why do i need a web app? becuase of size of my project? I mean if it
is going to be a very big website with lot of pages and tables etc.
should i have a webapp
On 02/21/2012 01:47 PM, Vyacheslav wrote:
Hello.
I'm new in perl and have many questions.
This my first programm.
#!/usr/bin/perl
use strict;
use warnings;
EXCELLENT START!
my $number = 0;
my $_ = 0;
print "Enter number:";
chomp($number = <>);
if ( $number = /[0-9]/) {
You want the matc
On 03/15/2012 09:11 AM, Anirban Adhikary wrote:
> I am writting a following code to parse this xml but not able yo
understand
> that why the value of $bsc_id_1 getting changed.
> here is my code
>
> use strict;
> use warnings;
>
> my $xml_file_to_read = "BSC-19478.xml";
> my $counter = 1;
> my $
ecial cases,
soft references are a terrible idea, and this snippet is a perfect
example of a case when you should NOT use them.
Why not
for ( 1 .. 100 ) {
push @buttons, $mw->Button->pack;
}
Now you have a nice list of 100 buttons in @buttons
--
Lawrence Statton - [EMAIL PROTECT
nt?
>
/tmp/* got expanded into a list of filenames matching that glob by the
shell long before Perl got involved.
You need to escape or quote your arguments such that the shell won't
glob filenames before launching your script.
./sr "/tmp/*"
--
Lawrence Statton - [EMA
foo = ( one => 'uno',
two => 'dos',
three => 'tres' );
is equivalent to ...
my %foo;
$foo{one} = 'uno';
$foo{two} = 'dos';
$foo{three} = 'tres';
--
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
> From [EMAIL PROTECTED] Wed Aug 8 15:44:30 2007
> Return-Path: <[EMAIL PROTECTED]>
> X-Original-To: [EMAIL PROTECTED]
> Delivered-To: [EMAIL PROTECTED]
> Received: from localhost (localhost [127.0.0.1])
> by hummer.cluon.com (Postfix) with ESMTP id 25F66339A0
> for <[EMAIL PROTECTED]
n, only the author of index.php would know for sure but passing in
'3' where the word 'number' is expected in the searchtype field may
lead to your lack of joy.
Not passing in any value for 'query' might also be causing grief.
--
Lawrence Statton - [EMAIL PROT
>
> Can anybody help me how to convert csv file to excel file using Perl
> or Shell scripts?
>
I would use Text::CSV_XS to read the CSV file and
SpreadSheet::WriteExcel to produce the Excel file.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
; > >
> > 'SomeName20070827.csv'};
> > # tie the table name to the filename
... here you can see they are mapping a table SomeName to the file
"SomeName20070827.csv"
--
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of on
> It is also is a stand-alone command to interpret Tcl scripts. I'd guess
> Tcl was the original source of source and was adopted by BASH and other
> shells afterwards. I don't know anything about Tcl but maybe it has a
> group of functions along the lines of file-type file-name.
>
I'd find tha
>
> $slope = ($ARGV[1] - $ARGV[3]) / ($ARGV[0] - $ARGV[2]);
> $b = $ARGV[1] - ($ARGV[0] * $slope);
> print "\n$ARGV[1] = $slope * $ARGV[0] + $b\n";
>
> For this input :
>
> perl my_program 16.81 16.57 0 0
>
> It gives me this result :
>
> 16.57 = 0.985722784057109 * 16.81 + 0
>
> Clearly
1 - 100 of 173 matches
Mail list logo