comp.lang.perl.misc
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
May 2008
motuwethfrsasuw
   1234 18
567891011 19
12131415161718 20
19202122232425 21
262728293031  22
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.perl.misc Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  FAQ 4.37 What's wrong with always quoting "$vars"?         


Author: PerlFAQ Server
Date: May 14, 2008 18:03

This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

4.37: What's wrong with always quoting "$vars"?

The problem is that those double-quotes force stringification--coercing
numbers and references into strings--even when you don't want them to be
strings. Think of it this way: double-quote expansion is used to produce
new strings. If you already have a string, why do you need more?

If you get used to writing odd things like these:

print "$var"; # BAD
$new = "$old"; # BAD
somefunc("$var"); # BAD

You'll be in trouble. Those should (in 99.8%% of the cases) be the
simpler and more direct:
Show full article (2.42Kb)
no comments
  How to control an already open spreadsheet         


Author: Peter Jamieson
Date: May 14, 2008 17:18

I am having a look at using Perl to control an Excel spreadsheet:

#!/usr/bin/perl -w
use strict;
use warnings;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3; # die on errors...

# Get already active Excel application or open new
my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
|| Win32::OLE->new('Excel.Application', 'Quit');

# select and open the Excel file
my $Book = $Excel->Workbooks->Open("C:/Documents and
Settings/mysheet.xls");

# do phunny things with the workbook...

No problems....but:

I read the Win32::OLE docs and elsewhere but could not find how to proceed
if the workbook $Book was already open, rather than opening a new instance
of the workbook.

Any help appreciated!
2 Comments
  Tk with Thread         


Author: Slickuser
Date: May 14, 2008 16:57

I am currently using perl, v5.8.8 built for MSWin32-x86-multi-thread.

I have a Button on my GUI, when I pressed the button. It will parse
some file.
The parsing will run but my GUI will freeze. Once it's done parsing, I
can control my GUI again.

Is there a way to use Thread so my parsing is running and I can still
use my GUI?

I was looking at http://visitorflow.com/perl/lib/Thread.html

But it doesn't work for me. I also try 'threads' as well.

Any help?
23 Comments
  generate all possible math expr of one term         


Author: xahlee
Date: May 14, 2008 16:49

Here's a example of Expressiveness of a Language.

The following is Mathematica code that generates all possible
equations of one term involving trig function. (tweak the funList and
nesting level to define what “all possible” means. if nesting level is
2, it takes about 20 minutes and returns a list of 2876 terms on a
2004 personal computer.
Show full article (2.93Kb)
2 Comments
  arrow key bindings in perl debugger mode         


Author: andrew
Date: May 14, 2008 14:59

Hi. I've been pouring over the debugger perldocs trying to figure out
how to change keyboard bindings, so for example the 'left' and 'right'
arrow keys let me move the cursor around the current line instead of
spitting out things like '^[[C', and mapping the 'up' arrow key to
cycle through the command history like it would at a command line
prompt. Am I approaching this completely wrong? Any advice would be
welcome. Thanks :)
11 Comments
  URGENT: SENIOR SAP PP/MM ANALYST - San Jose, CA         


Author: khan.aadilrasheed
Date: May 14, 2008 13:51

Please respond me ASAP with

1) Your latest word formatted resume.
2) Salary range per annum
3) Start Date
4) Contact Info(mobile #, and best time to take telephonic interview)
5) Visa Status

Position Title : SAP MM/PP Functional Analyst
Location :San Jose-CA

The Senior SAP PP/MM Analyst will support the existing global PP and
MM deployment, enhancements to the existing install base as well as
help MM and PP teams in major enterprise wide projects.

RESPONSIBILITIES:

- Configuration expertise of MM and PP modules including:
- Master Data
- AP impact due to MM processes
- RTV processes
- MRP
- IDOC setup and troubleshoot
- Solid knowledge in SAP role based security
Show full article (1.20Kb)
4 Comments
  exclude with regular expression         


Author: fred78980
Date: May 14, 2008 12:09

What is the regular expression that sees
foobar,barfoo,barbarfoo,foobabarfoo etc. but not words between {}

foobar {worda, wordb, wordc} barfoo {worda, wordb, wordc} barbarfoo
{worda, wordb, wordc} foobarbarfoo

Negation is not suited and I have no idea how to achieve that.

Thanks in advance
2 Comments
  FAQ 4.55 How do I process an entire hash?         


Author: PerlFAQ Server
Date: May 14, 2008 12:03

This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

4.55: How do I process an entire hash?

(contributed by brian d foy)

There are a couple of ways that you can process an entire hash. You can
get a list of keys, then go through each key, or grab a one key-value
pair at a time.

To go through all of the keys, use the "keys" function. This extracts
all of the keys of the hash and gives them back to you as a list. You
can then get the value through the particular key you're processing:

foreach my $key ( keys %%hash ) {
my $value = $hash{$key}
...
}
Show full article (3.16Kb)
no comments
  how can I pass javascript window.confirm result back to my perl cgi program         


Author: Grehom
Date: May 14, 2008 08:07

I want to know whether the user confirmed the button press, or if they
cancelled it. This is my trial script - I have tried a lot of
variations on this and searched for similar online, thanks for any
help.

#!/usr/bin/perl

use strict;
use warnings;
use English qw( OUTPUT_AUTOFLUSH );

use CGI qw/:standard *table/;

$ENV{PATH} = "/bin:/usr/bin"; # Straight and narrow path

# alternative for $|, if set to non-zero forces a flush after every
write
# or print on the currently selected output handle
$OUTPUT_AUTOFLUSH = 1; # unbuffer STDOUT
Show full article (1.46Kb)
2 Comments
  FAQ 4.36 How can I expand variables in text strings?         


Author: PerlFAQ Server
Date: May 14, 2008 06:03

This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

4.36: How can I expand variables in text strings?

(contributed by brian d foy)

If you can avoid it, don't, or if you can use a templating system, such
as "Text::Template" or "Template" Toolkit, do that instead. You might
even be able to get the job done with "sprintf" or "printf":

my $string = sprintf 'Say hello to %%s and %%s', $foo, $bar;

However, for the one-off simple case where I don't want to pull out a
full templating system, I'll use a string that has two Perl scalar
variables in it. In this example, I want to expand $foo and $bar to
their variable's values:

my $foo = 'Fred';
my $bar = 'Barney';
$string = 'Say hello to $foo and $bar';
Show full article (3.18Kb)
no comments
1 2