comp.lang.perl.misc
  Home FAQ Contact Sign in
Your Ad Here
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
  Why Larry Wall uses this background color #e0ff00 for his web page         


Author:
Date: May 8, 2008 23:20

http://www.wall.org/~larry/perl.html,

just curious, but this is odd, and does harm the eyes : 0, what do u
think?
5 Comments
  Posting Guidelines for comp.lang.perl.misc ($Revision: 1.8 $)         


Author: tadmc
Date: May 8, 2008 23:10

Outline
Before posting to comp.lang.perl.misc
Must
- Check the Perl Frequently Asked Questions (FAQ)
- Check the other standard Perl docs (*.pod)
Really Really Should
- Lurk for a while before posting
- Search a Usenet archive
If You Like
- Check Other Resources
Posting to comp.lang.perl.misc
Is there a better place to ask your question?
- Question should be about Perl, not about the application area
How to participate (post) in the clpmisc community
- Carefully choose the contents of your Subject header
- Use an effective followup style
- Speak Perl rather than English, when possible
- Ask perl to help you
- Do not re-type Perl code
- Provide enough information ...
Show full article (16.63Kb)
no comments
  FAQ 4.27 How can I access or change N characters of a string?         


Author: PerlFAQ Server
Date: May 8, 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.27: How can I access or change N characters of a string?

You can access the first characters of a string with substr(). To get
the first character, for example, start at position 0 and grab the
string of length 1.

$string = "Just another Perl Hacker";
$first_char = substr( $string, 0, 1 ); # 'J'

To change part of a string, you can use the optional fourth argument
which is the replacement string.

substr( $string, 13, 4, "Perl 5.8.0" );

You can also use substr() as an lvalue.

substr( $string, 13, 4 ) = "Perl 5.8.0";

--------------------------------------------------------------------
Show full article (1.58Kb)
no comments
  A question on next         


Author: grocery_stocker
Date: May 8, 2008 17:19

At work, one of the engineers did something like the following to
parse a 100MB apache log file.

while () {
next unless (/^\w+\s([a-zA-Z\.]+)\s\w+\s\w+\s\w+\s(\d+)$/);
$locationhash{$1} += $2;

}

He told me this loop wouldn't check every single in the log file. I
don't see how this is possible. Can someone clarity this? Thank you.
2 Comments
  trailing spaces in unpack("A10")         


Author: Klaus
Date: May 8, 2008 12:52

According to "perldoc perlpacktut", I could use unpack to extract
fixed length fields:

from "perldoc perlpacktut":
+++++++++++++++++++++++++++++++++++++
++ [...] we can see that the date column stretches from
++ column 1 to column 10 - ten characters wide. The
++ pack-ese for "character" is A, and ten of them are
++ A10. So if we just wanted to extract the dates, we
++ could say this:
++
++ my($date) = unpack("A10", $_);
+++++++++++++++++++++++++++++++++++++

So I have created a test case with 3 A's then 7 spaces, followed by 3
B's:

use strict;
use warnings;
$_ = 'AAA BBB';
my $result = unpack("A10", $_);
print "result = '$result'\n";
Show full article (1.19Kb)
3 Comments
  FAQ 3.31 What's MakeMaker?         


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

This is an excerpt from the latest version perlfaq3.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 .

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

3.31: What's MakeMaker?

(contributed by brian d foy)

The "ExtUtils::MakeMaker" module, better known simply as "MakeMaker",
turns a Perl script, typically called "Makefile.PL", into a Makefile.
The unix tool "make" uses this file to manage dependencies and actions
to process and install a Perl distribution.

--------------------------------------------------------------------
Show full article (1.30Kb)
1 Comment
  Perl OLE Excel - edit width/height Comment window         


Author: Slickuser
Date: May 8, 2008 10:32

I have achieved adding comments but I can't change the width and
height of the comment box. Any help?

This is the VBA macro code:
Range("C23").Comment.Text Text:= _
"Slickuser:" & Chr(10) & "Helllo " & Chr(10) & ""
& Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "wowow this
is awesome!!!!!!!!!!!! " & Chr(10) & "what!!"
Selection.ShapeRange.ScaleWidth 1.76, msoFalse,
msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.54, msoFalse,
msoScaleFromTopLeft
Range("C23").Comment.Shape.Select True
ActiveWindow.SmallScroll Down:=6
Range("F19").Select

Perl OLE Browser info:

Comment: Property Shape As Shape readonly
ShapeRange: Sub ScaleHeight(Factor As VT_R4, RelativeToOriginalSize As
MsoTriState, [Scale])

Here is the Perl code:
Show full article (1.29Kb)
3 Comments
  Perl DBI Module: SQL query where there is space in field name         


Author: ambarish.mitra
Date: May 8, 2008 07:00

Hi all,

Using the DBI module, I have connected to a CSV file, and am trying to
execute SQL queries on the CSV file. I am stuck when there is a space
in the field name and I cannot proceed.

The CSV file col heading:
"Attribute","Display Name","Semantic Type","Display Type". (ie, space
in the heading)

I am trying to "prepare" only those lines for which 'Display Type' is
given.

The error line is given:

my $sth = $dbh->prepare("select * from report where [Display Type]
=MultiLineText");

SQL ERROR: Bad table or column name '[Display Type]' has chars not
alphanumeric or underscore!
SQL ERROR: Couldn't find predicate!

I have tried some googling and also tried multiple combination of
brackets/qoutes/escapes with a hope that one of them will work, but
without luck.
Show full article (0.92Kb)
78 Comments
  Is this expected in a foreach()?         


Author: Gowtham
Date: May 8, 2008 06:47

Is this expected? I feel changes to $b shouldn't change the array
@a ...

DB<26> @a = qw/ A B C /;

DB<27> foreach my $b ( @a ) { $b =~ s/([A-Z])/lc $1/e; }

DB<28> x @a
0 'a'
1 'b'
2 'c'

This is perl 5.8.8

Thanks
Gowtham
9 Comments
Your Ad Here
  FAQ 3.17 Is it safe to return a reference to local or lexical data?         


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

This is an excerpt from the latest version perlfaq3.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 .

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

3.17: Is it safe to return a reference to local or lexical data?

Yes. Perl's garbage collection system takes care of this so everything
works out right.

sub makeone {
my @a = ( 1 .. 10 );
return \@a;
}

for ( 1 .. 10 ) {
push @many, makeone();
}

print $many[4][5], "\n";

print "@many\n";

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