perl.beginners
  Home FAQ Contact Sign in
perl.beginners 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
perl.beginners Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  how to shorten this code ? x occur how many times in variable         


Author: Richard Lee
Date: May 6, 2008 22:43

Can you please tell me how to shorten this?

my @an = split(//);
my @num = grep { $_ eq ':' } @an ;

I was trying to see how many : occur in variable but didn't know how to
do it fast so i did it like above...

I would like to see as many way different ways to get this done if possible

thank you!!

$var1 = root:x:123:/root:

trying to see how many times : occurs in $var1..... and I could only do
it above way....
6 Comments
  Text formatting issues         


Author: Hotkitty
Date: May 6, 2008 19:04

First and foremost thanks for all the help I've received on this
board, especially Gunnar who keeps this place running!

I've come a long way in my code and am trying to format some text and
then put it into a nice pdf file. My problem is putting the formatted
text into the pdf and for it to display correctly. I am just trying to
justify the text and then set the margins. I can put the text in the
pdf and it looks like it is trying to justify it but it won't wrap to
the next line. I've looked at the documentation for both the
Text::Autoformat and PDF::API2 modules but can't seem to figure it
out.

I have 2 questions: 1. What am I doing wrong in that the text will
appear fine when I "print" it but that it won't appear correctly in
the pdf file? 2. Also, if the text is more than 1 page, how can I get
it to automatically create a new page and continue onto the newly
created page?

My code:

#!/usr/bin/perl

use warnings;
Show full article (2.42Kb)
9 Comments
  Compare String is not match !         


Author: Vu Dinh Chung
Date: May 6, 2008 18:55

Hi all,
My code is below
*My code runs;*
when run $array[$j][1] = 101-P-467593 ( this value is stored in excel
file and this value input by hand ) and $accountNumber = 101-P-467593
*My code doens't run :*
when run $array[$j][1] = 101-P-467593 ( this value is stored in excel
file and it is resulted from query and export to Excel format )and
$accountNumber = 101-P-467593 , We compare two values but The compare is
not founded ? --> if i change this value by hand , it is okie ,
comparation is successsful
I check in excel file for both case , the format is General .
I don't know why !
Advise me please !
Thanks

/
/*
/sub findEmailID {

my $accountNumber = shift;
Show full article (1.03Kb)
no comments
  re: find path to current file, NOT working directory         


Author: morphis
Date: May 6, 2008 13:40

Apologies, I had looked at special variables, but not far enough,
in winxp $0 provides a full path of the current script.
Sorry for the bother
Robert
no comments
  Compile error         


Author: Rodrigo Tavares
Date: May 6, 2008 07:43

Hello,

I create a hash, and i want take the keys.
Using Deitel Book, i take this example:

numbers =
(
1 => 'one',
3 => 'two',
5 => 'three',
7 => 'four',
9 => 'five',
);
@hashkey = keys (%%numbers);

When I try to run come this message.
Undefined subroutine &main::chaves called at line

What's wrong ?

By,

Faria

Abra sua conta no Yahoo! Mail, o único sem limite de espaço para armazenamento!
http://br.mail.yahoo.com/
2 Comments
  chaining defines         


Author: Robert Hicks
Date: May 6, 2008 06:49

Is there anything wrong with:

if ( defined $one && defined $two && $one eq $two ) {
#### do something
}
4 Comments
  csv file question         


Author: Anirban Adhikary
Date: May 6, 2008 02:11

Dear list
I have a csv file having the following contents.
col1 col2 col3
"A", "1","2"
"B","1", "3"
"C","2","4"
"D","1","5"
"A","1","6"
"B","2","7"
"C","2","8"
" ","3","9"

Now I want to implement a logic which will show me the summarize records as
follows
col1 count
A- 2
B - 2
C - 2
D - 1

and one more question how the null value will be handled
Show full article (0.41Kb)
3 Comments