comp.lang.perl.misc
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
February 2008
motuwethfrsasuw
    123 5
45678910 6
11121314151617 7
18192021222324 8
2526272829   9
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.12 How do I find the day or week of the year?         


Author: PerlFAQ Server
Date: Feb 22, 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.12: How do I find the day or week of the year?

The localtime function returns the day of the year. Without an argument
localtime uses the current time.

$day_of_year = (localtime)[7];

The "POSIX" module can also format a date as the day of the year or week
of the year.

use POSIX qw/strftime/;
my $day_of_year = strftime "%%j", localtime;
my $week_of_year = strftime "%%W", localtime;

To get the day of year for any date, use "POSIX"'s "mktime" to get a
time in epoch seconds for the argument to localtime.
Show full article (1.94Kb)
no comments
  Spreadsheet::ParseExcel - How to get certain Cells         


Author: Tom Brown
Date: Feb 22, 2008 14:22

Hello,

how may I get certain cells (rows and columns) from an Excel file using
the module Spreadsheet::ParseExcel???

Let's asume an Excel-sheet contains the following values:

[ A ][ B ][ C ]
[1] Cell_A1 Cell_B1 Cell_C1
[2] Cell_A2 Cell_B2 Cell_C2
[3] Cell_A3 Cell_B3 Cell_C3
[4] Cell_A4 Cell_B4 Cell_C4
[5] Cell_A5 Cell_B5 Cell_C5
[6] Cell_A6 Cell_B6 Cell_C6

Let's asume further B2 - B5 are the cells I would like to parse. I
tried it out with the following code, but there are few mistakes.

[-------------------------CODE-------------------------]
use strict;
use Spreadsheet::ParseExcel;
my $Excel_file = new Spreadsheet::ParseExcel;
Show full article (1.97Kb)
7 Comments
  glob a directory then sort by timestamp         


Author: jhellma1
Date: Feb 22, 2008 12:46

All,

I am trying to glob a directory, storing the filenames into an array.
The trick is that I then want to sort that array by the files'
timestamps. Is there an easy way to do this?

TIA!
5 Comments
  FAQ 4.20 How do I unescape a string?         


Author: PerlFAQ Server
Date: Feb 22, 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.20: How do I unescape a string?

It depends just what you mean by "escape". URL escapes are dealt with in
perlfaq9. Shell escapes with the backslash ("\") character are removed
with

s/\\(.)/$1/g;

This won't expand "\n" or "\t" or any other special escapes.

--------------------------------------------------------------------
Show full article (1.26Kb)
no comments
  Split a string in perl         


Author: John
Date: Feb 22, 2008 11:01

There must be something that I have ignored in PERL.

To split a string with delimiter "|", sometimes, I need to give "\",
sometimes it works for "\\" only.

Here are the details.

The String is " 0000|Null".

And the ways I have tried to do split are:
1. my @columns = split('\|', $String);
2. my ( $proj, $desc) = split('\|', $String);
3. my ( $proj, $desc) = split('\\|', $String);

Case 1 and Case 3 are good. But Case 2 failed, both $proj and $desc
receive an empty string .

What was wrong with case 2 , I thought if Case 1 works, Case2 should
be working also, Right ? I am using perl 5.6.1 on linux box.

Thanks a lot for the tips.

John.
7 Comments
  Intention to take over Finance::Bank::Cahoot         


Author: Jon Connell
Date: Feb 22, 2008 10:39

Finance::Bank::Cahoot - currently owned by Andy Kelk (user ID mopoke)
- seems to have gone rather stale and the module that lived there
previously has been removed. The following module:

http://search.cpan.org/~masaccio/Finance-Bank-Cahoot

is living in its place, but ownership of the namespace would need to
be transferred to me for it to be authorized.

Please let me know if you actually think you own this namespace (Andy
is not answering on his CPAN email address and it's started bouncing
email).

Jon.
no comments
  Speeding my script         


Author: Petyr David
Date: Feb 22, 2008 10:38

have a web page calling PERL script that searches for patterns in 20,
000 files + and returns link to files and lines found matching
pattern. I use a call to `find` and `egrep`

Q: Script works - but is straining under the load - files are in the
Gbs.
How to speed process? How simple to employ threads or slitting
off
new processes?

I know i should RTFM (LOL) and I will, but just looking for some
quick guidance/suggestions

pseudo code;

cd root of document directory

Load array with names of directories

forech subdir in @dirnames
Show full article (0.90Kb)
6 Comments
  Dinero Facil         


Author: javierf.61
Date: Feb 22, 2008 09:38

GRATIS - Negocio Rentable!news gropus
Publicado por Alejandro Escobar el Febrero 18avo.
Crosas gratuitas - Artículos gratis | 12 vistazos
¿NECESITA DINERO RÁPIDO?

APRENDA COMO HACER DINERO FACIL, DE FORMA SEGURA Y TOTALMENTE
LEGAL!!!!

Hola, amigos:

Te cuento mi caso: Estando en una situación económica muy precaria y
donde las puertas se me cerraban una tras otra y no teniendo a quién
acudir, pues en estos momentos los amigos se
alejan o están demasiado ocupados para ayudarte, fue que me encontré
con un aviso en Internet donde se entregaban diversos pasos para
comenzar a trabajar en cadena,

honestamente siguiendo cada etapa, y la inversión que había que hacer
era de sólo 6 dólares o 6 euros.

Al principio pensé que era una estafa, pero debido a mi necesidad
económica me arriesgué, invertí, envié el dinero a las seis personas
de la lista. Y los resultados han sido
maravillosos. Comencé a recibir...
Show full article (9.85Kb)
no comments
  BEGIN not safe after errors--compilation aborted         


Author: daz9643
Date: Feb 22, 2008 08:26

I've got 2 perl scripts, both are code for ads. One script is admob,
the other is google. The code provided has been cut and pasted without
any mods. The admob code works, the google code doesn't and i get the
error,
syntax error at googleperlcode.cgi line 9, near "sub
google_append_color "
Can't use global @_ in "my" at googleperlcode.cgi line 10, near ", $_"
syntax error at googleperlcode.cgi line 12, near "}"
Execution of googleperlcode.cgi aborted due to compilation errors.

This is the actual google code,
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
ul class="simpleblue"
sub google_append_color {
my @color_array = split(/,/, $_[0]);
return $color_array[$_[1] %% @color_array];
}
Show full article (0.85Kb)
9 Comments
  FAQ 4.25 How do I expand tabs in a string?         


Author: PerlFAQ Server
Date: Feb 22, 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.25: How do I expand tabs in a string?

You can do it yourself:

1 while $string =~ s/\t+/' ' x (length($&) * 8 - length($`) %% 8)/e;

Or you can just use the "Text::Tabs" module (part of the standard Perl
distribution).

use Text::Tabs;
@expanded_lines = expand(@lines_with_tabs);

--------------------------------------------------------------------
Show full article (1.31Kb)
no comments
1 2