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
  Posting Guidelines for comp.lang.perl.misc ($Revision: 1.8 $)         


Author: tadmc
Date: May 1, 2008 23:19

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.11 How do I get a random number between X and Y?         


Author: PerlFAQ Server
Date: May 1, 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.11: How do I get a random number between X and Y?

To get a random number between two values, you can use the "rand()"
built-in to get a random number between 0 and 1. From there, you shift
that into the range that you want.

"rand($x)" returns a number such that "0 <= rand($x) < $x". Thus what
you want to have perl figure out is a random number in the range from 0
to the difference between your *X* and *Y*.

That is, to get a number between 10 and 15, inclusive, you want a random
number between 0 and 5 that you can then add to 10.

my $number = 10 + int rand( 15-10+1 ); # ( 10,11,12,13,14, or 15 )

Hence you derive the following simple function to abstract that. It
selects a random integer between the two given integers (inclusive), For
example: "random_int_between(50,120)".
Show full article (2.17Kb)
no comments
  FAQ 3.18 How can I free an array or hash so my program shrinks?         


Author: PerlFAQ Server
Date: May 1, 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.18: How can I free an array or hash so my program shrinks?

(contributed by Michael Carman)

You usually can't. Memory allocated to lexicals (i.e. my() variables)
cannot be reclaimed or reused even if they go out of scope. It is
reserved in case the variables come back into scope. Memory allocated to
global variables can be reused (within your program) by using undef()ing
and/or delete().

On most operating systems, memory allocated to a program can never be
returned to the system. That's why long-running programs sometimes re-
exec themselves. Some operating systems (notably, systems that use
mmap(2) for allocating large chunks of memory) can reclaim memory that
is no longer used, but on such systems, perl must be configured and
compiled to use the OS's malloc, not perl's.
Show full article (1.99Kb)
no comments
  Stuffing @users into $self->{'users'}         


Author: Philluminati
Date: May 1, 2008 06:46

Hi everyone.

I'm writing a SOAP Server in perl and I need/want to use objects. I
have an array called @users which is populated in sub new. I want to
store this array in my $self variable which is passed to all functions
and then pull it out later. Can somebody help me?

sub new
{
my ($class_name) = @_;
my ($self) = {};
bless ($self, $class_name);

my $phill = new user;
$phill->setId(6);
$phill->setUsername("ptaylor");
$phill->setPassword("password");
$phill->setSessionKey("");

#cut some code out to stop the post being enormous.

my @users = ( $phill );

$self->{'users'} = [ @users ];

return $self;
Show full article (1.10Kb)
28 Comments
  FAQ 3.16 How can I make my Perl program take less memory?         


Author: PerlFAQ Server
Date: May 1, 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.16: How can I make my Perl program take less memory?

When it comes to time-space tradeoffs, Perl nearly always prefers to
throw memory at a problem. Scalars in Perl use more memory than strings
in C, arrays take more than that, and hashes use even more. While
there's still a lot to be done, recent releases have been addressing
these issues. For example, as of 5.004, duplicate hash keys are shared
amongst all hashes using them, so require no reallocation.
Show full article (5.18Kb)
no comments
  Help: Replace Help         


Author: Amy Lee
Date: May 1, 2008 05:29

Hello,

I'm going to process some RNA sequences files. And I make a small script
to reverse these sequences. However, I face a problem while it's running
because of order problem.

This is my file contents.
>seq1
ACGU
>seq2
GUACCGU

And I wanna replace A to C, C to A, G to U, U to G. So from my point the
reversed file should be viewed like this.
>seq1
CAUG
>seq2
UGCAAUG

This is my codes.
Show full article (1.15Kb)
14 Comments
Your Ad Here
  FAQ 3.8 Is there a pretty-printer (formatter) for Perl?         


Author: PerlFAQ Server
Date: May 1, 2008 00: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.8: Is there a pretty-printer (formatter) for Perl?

Perltidy is a Perl script which indents and reformats Perl scripts to
make them easier to read by trying to follow the rules of the perlstyle.
If you write Perl scripts, or spend much time reading them, you will
probably find it useful. It is available at
http://perltidy.sourceforge.net
Show full article (2.39Kb)
no comments