comp.lang.perl.misc
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
January 2008
motuwethfrsasuw
 123456 1
78910111213 2
14151617181920 3
21222324252627 4
28293031    5
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 7.19 What's the difference between deep and shallow binding?         


Author: PerlFAQ Server
Date: Jan 9, 2008 18:03

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

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

7.19: What's the difference between deep and shallow binding?

In deep binding, lexical variables mentioned in anonymous subroutines
are the same ones that were in scope when the subroutine was created. In
shallow binding, they are whichever variables with the same names happen
to be in scope when the subroutine is called. Perl always uses deep
binding of lexical variables (i.e., those created with my()). However,
dynamic variables (aka global, local, or package variables) are
effectively shallowly bound. Consider this just one more reason not to
use them. See the answer to "What's a closure?".

--------------------------------------------------------------------
Show full article (1.60Kb)
no comments
  Force return of the diamond operator from network socket         


Author: Nate Bargmann
Date: Jan 9, 2008 13:04

I am involved with a project that will use a server process written in C
and a client written in Perl. The processes will communicate over a
network socket that is opened when the Perl process starts and and remains
open throughout the life of the Perl program.

The server is queried by the Perl program and responds with short text
strings that are newline terminated. The server can return from one to
three lines depending on the query. This part is working well.

Here is where I am running into trouble. I am using the diamond
operator to read from the socket as in:

while (<$socket>) {
chomp;
print "$_\n";
}

however, the diamond operator doesn't return despite trying to send a NULL
string from the C program through the socket. Here is a snippet of my C
program:

fprintf(fout, "");
fflush(fout);
Show full article (1.21Kb)
8 Comments
  Checking the Platform in Perl         


Author: mariakvelasco
Date: Jan 9, 2008 12:28

Hello all,

Is there a way using perl code to check what platform the script is
running on? I have a script that runs on both windows and unix
platforms and I want to check what platform the script is running on
because I will be executing different sections of the code depending
on the platform.

Thanks!
1 Comment
  FAQ 7.28 How do I clear a package?         


Author: PerlFAQ Server
Date: Jan 9, 2008 12:03

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

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

7.28: How do I clear a package?

Use this code, provided by Mark-Jason Dominus:
Show full article (1.93Kb)
no comments
  Search/Replace text in XML file         


Author: Lax
Date: Jan 9, 2008 11:21

Hello all,
I'm trying to search and replace the value of a tag in an xml file.
I'm not in a position to use the usual XML parsers as the version of
Perl I'm required to use
doesnt contain any of the XML libraries. I can use Text::Balanced, but
I want to deal with the xml file on a
line-by-line basis, as the value of my tag could strecth over multiple-
lines.

Perl Version:
This is perl, v5.8.7 built for sun4-solaris

Sample xml file:
-------------------------



1.0.0


invalid version
Show full article (2.84Kb)
5 Comments
  how to do bit complement in perl         


Author: IJALAB
Date: Jan 9, 2008 11:20

hi all,

i have a file in which there are 8 byte hex values one followed by
another. For example:
2A414364
00001DA9
01A3F9DD
3FFFF661
00EE6670
000011CF
2BC43FD0
3FEB0003
3F7FFF40
Show full article (0.80Kb)
2 Comments
  Help with a Reg Ex         


Author: amerar
Date: Jan 9, 2008 11:00

I have the following expression in my Perl script:

if (/^"([^\,].+)"\,"$/)

Although I know that it is checking to see if the string starts with
some characters, it is not working for my input file.

Can someone explain to me in english what it is doing???

Thanks in advance.
12 Comments
  Perl Database Programing download for the template         


Author: kwan
Date: Jan 9, 2008 09:57

Hello!

I have this book, but I couldn't located the template download that
describe in the book. Could anyone point me to the download link for
the template? I appreciate for your help.

------------Book information------
Perl Database Programming
by Brent Michalski ISBN:0764549561
John Wiley & Sons © 2003 (552 pages)
Here is an in-depth guide to creating database-driven applications
using Perl

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

Thank you
2 Comments
  Re: Active State perl for windows not working.         


Author: Jürgen Exner
Date: Jan 9, 2008 09:48

still just me yahoo.com> wrote:
>On Tue, 08 Jan 2008 16:34:38 -0400, Caduceus fusemail.com>
>wrote:
>
>>When I try to type in perl -v, perl -h,perl -w, or perl -procinv.pl
>>nothing happens. Is there something I can do for this? TIA Steve
>
>start a command window, change to the perl directory (e.g. c:\perl)
>and see what happens. If it works, then you have a simple PATH
>problem. You can fix that through windows, by writing a .bat file to
>set the path each time you use perl, or do a re-install and allow the
>install to modify the system path for you.

Any reason why not simply adding the perl bin directory to the path
permanently?
Control Panel -> System -> Advanced -> Environment Variables

jue
2 Comments
  FAQ 7.22 What's the difference between calling a function as &foo and foo()?         


Author: PerlFAQ Server
Date: Jan 9, 2008 06:03

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

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

7.22: What's the difference between calling a function as &foo and foo()?

When you call a function as &foo, you allow that function access to your
current @_ values, and you bypass prototypes. The function doesn't get
an empty @_--it gets yours! While not strictly speaking a bug (it's
documented that way in perlsub), it would be hard to consider this a
feature in most cases.

When you call your function as "&foo()", then you *do* get a new @_, but
prototyping is still circumvented.
Show full article (1.87Kb)
no comments
 
1 2