Hey. In Python I can do this:
def fnuh():
a = "foo"
b = "bar"
return a,b
Can I return a list in a similarly elegant way in perl, especially when the return type of the subroutine should be a reference to an array?
I know I can do
sub fnuh {
my $a = "foo";
my $b = "bar";
my $return = [];
push (@{$return}, ...
I have a Perl web application that runs on both Apache and IIS6 on Windows Server 2003. On Apache this script works just fine. In IIS using ISAPI, I am getting the following error message:
Software error:
Can't load
'lib/auto/Sub/Name/Name.dll' for
module Sub::Name: load_file:The
specified module could not be found at
C:/...
Hello!
So I'm aware of the big ammount of general-purpose scripting languages like Ruby, Python, Perl, maybe even PHP, etc. that actually claim being usable for creating desktop applications too.
I think my question can be answered clearly
Are there actually companies using a special scripting language only to create their applicatio...
So I have the following snippet code:
my $sql = "INSERT INTO mytbl (first_name, last_name, birthdate) VALUES (?, ?, ?)";
my $sth = $dbh->prepare($sql) or die "Error:".$dbh->errstr;
$sth->bind_param(1, $fname);
$sth->bind_param(2, $lname);
$sth->bind_param(3, $bdate);
$sth->execute() or die "Execution failed: " . $dbh->...
I tried Google.
I tried Yahoo.
I tried Bing.
None of them had results for the $[ variable. Does anyone know where I can find the documentation for it?
...
I would like to use an environment variable in the href link of the xi:include node of an XML file. Currently the Perl XInclude parser doesn't support any variables but only absolute paths. Is there a method where this can be overcome?
for example, my xi:include node will look like this:
<xi:include href="$GLOBAL_ROOT/alternative.xml">
...
Hello, does the "or die $!"-part in the "close $fh or die $!;"-line any good?
#!/usr/bin/env perl
use warnings;
use strict;
my $file = 'my_file';
open my $fh, '<', $file or die $!;
print <$fh>;
close $fh or die $!;
...
I am trying to print a XML file in the browser using a perl script. While I am trying to run the script in my browser I am having the following error.
Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
Premature end of script headers: get_data.pl
If you think this is a server...
Hello!
I'm trying to write a configuration script.
For each customer, it will ask for variables, and then write several text files.
But each text file needs to be used more than once, so it can't overwrite them. I'd prefer it read from each file, made the changes, and then saved them to $name.originalname.
Is this possible?
...
Is it possible to reverse an anonymous list in template toolkit?
e.g.
[% FOREACH month IN [1..12].reverse %]
[% month %]
[% END %]
(except that doesn't work).
Just wondered if there was a neat way to do it without using variables or explicitly typing out the array.
...
I am trying to use ImageMagick to extent an image a little bit:
my $image = Image::Magick->new;
open( IMAGE, $filename );
$image->Read( file => \*IMAGE );
close(IMAGE);
$image->Extent( gravity => 'Center', width => 150, height => 150, );
$image->Write( $outfile );
while the the image is extented to the correct size, it is not in the...
Are there links, materials, or books about network programming with Perl that are relevant to 2010? I saw some books on programming the network with Perl are very old (about a decade) and the tutorials on the internet are also old and using old modules.
Could someone provide a good reference about programming sockets and network layer/...
I was told that the following portion of code is deeply recursive. However I don't understand how - can someone explain?
If so, what are the associated implications?
Note:
Trivial example
check:
# Grab some data held in a file
while ((ReadFile ()) != 0 ) {
if ((checkSomething ...
I have a string of the form:
"jflsdlf f fas253k46l ;sf635jsf sd;lfwio sfkljflsk-=fsd f 24461 425 "
Toward the end it contains eight digits. There may be spaces between the digits, but there are always eight digits in the end. How do we obtain each of these digits separately using Perl?
...
I'm working with a third-party vendor who unfortunately requires that we set up a SOAP server to handle requests from them. I'm having some trouble finding the best way to go about this. One limitation I'm imposing is that it runs as a mod_perl2 handler. After some searching I've found that the best way may be to use XML::Compile and ...
I am running Perl script under cygwin which takes input from <STDIN> and process the requests continuously.
#!/usr/bin/perl
print "Enter Input:";
while(<STDIN>) {
print "Recieved Input: $_";
print "Enter Input:";
}
$perl testPerl.pl
Enter input:input1
Recieved input:input1
Enter input:inpt2
Reciev...
I am in a Web Scripting class at school and am working on my first assignment. I tend to overdo things and delve deeper into my subject than what is required in my classes. Right now I am researching CGI.pm to do my HTTP requests and it says there are two programming styles for CGI.pm:
An object-oriented style
A function-oriented style...
I have a simple xml file that looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<microplateDoc xmlns="http://moleculardevices.com/microplateML">
<camelids>
<species name="Camelus bactrianus">
<common-name>Bactrian Camel</common-name>
<physical-characteristics>
<mass>450 to 500 kg.</mass>
...
I have an XML file, part of which looks like this:
<wave waveID="1">
<well wellID="1" wellName="A1">
<oneDataSet>
<rawData>0.1123975676</rawData>
</oneDataSet>
</well>
... more wellID's and rawData continues here...
I am trying to parse the file with Perl's libXML and output the wellName and the rawDat...
Possible Duplicates:
Why is floating point arithmetic in C# imprecise?
Why does ghci say that 1.1 + 1.1 + 1.1 > 3.3 is True?
#!/usr/bin/perl
$l1 = "0+0.590580+0.583742+0.579787+0.564928+0.504538+0.459805+0.433273+0.384211+0.3035810";
$l2 = "0+0.590580+0.583742+0.579788+0.564928+0.504538+0.459805+0.433272+0.384211+0.3035810";
$...