How do I fetch a news article or the active newsgroups? ... ::NNTPClient->new->list("newsgroups")'
} else { substr($new, $i, 1) = uc(substr($new, $i, 1)); ... } elsif ($state == 2) { substr($new, $oldlen) = uc(substr($new, $oldlen
If you want to preserve the original hashes, copy one hash (%hash1) to a new hash (%new_hash), then add ... the keys from the other hash (%hash2 to the new hash.
) or system("mv", $old, $new); It may be more portable to use the File::Copy module instead. ... You just copy to the new file to the new name (checking return values), then delete the old one.
He suggests (assuming your string is contained in $text): @new = (); push(@new, $+ ... module (part of the standard Perl distribution) lets you say: use Text::ParseWords; @new
use MIME::Lite; ### Create a new multipart message: $msg = MIME::Lite->new( ... mixed' ); ### Add parts (each "attach" has same arguments as "new
local($x) saves away the old value of the global variable $x and assigns a new value for the duration ... my($x) creates a new variable that is only visible in the current subroutine.
Production releases, which incorporate bug fixes and new functionality, are widely tested before release ... invalidate a program written for an earlier version of perl (barring accidental bug fixes and the rare new
use File::Copy; copy( $original, $new_copy ) or die "Copy failed: $!" ... You also have to remember to copy the permissions, owner, and group to the new file.
", -8))); Using the CPAN module Bit::Vector: use Bit::Vector; $vec = Bit::Vector->new_Hex ... dec = oct("33653337357"); Using Bit::Vector: use Bit::Vector; $vec = Bit::Vector->new
Think of it this way: double-quote expansion is used to produce new strings. ... If you get used to writing odd things like these: print "$var"; # BAD $new
You have to put these directives at the beginning of the line and somewhere where Perl expects a new ... the comment with =cut, ending the Pod section: =pod my $object = NotGonnaHappen->new
(contributed by brian d foy) Ponie stands for "Perl On the New Internal Engine", started by Arthur Bergman ... Instead of using the current Perl internals, Ponie aimed to create a new one that would provide a translation
; open my $out, '>', "$file.new" or die "Can't write new file: $!" ... open my $out, '>', "$file.new" or die "Can't write new file: $!"
splice, randomly picking another element to swap the current element with srand; @new ... = (); @old = 1 .. 10; # just a demo while (@old) { push(@new, splice
handshaking, then the standard dual-process approach will suffice: use IO::Socket; # new ... in 5.004 $handle = IO::Socket::INET->new('www.perl.com:80') or die "can't connect
; To open file for writing, create new file if needed or else truncate old file: open(FH, " ... See also the new perlopentut if you have it (new for 5.6).
If you don't have a modern enough Perl installed, use the new_tmpfile class method from the IO::File ... () or die "Unable to make new temporary file: $!"
foobarbarbar Finally foo The $f that has "bar" added to it three times should be a new ... $f my $f should create a new lexical variable each time through the loop.
This will mean a new variable might accidentally be associated with the value for an old. ... handle renaming the keys if you use multiple threads (which causes all variables to be reallocated at new
Here's an example: $person = {}; # new anonymous hash $person->{AGE
To change the file, make a new shadow password file (the format varies from system to system--see passwd
Here's an example: use HTTPD::UserAdmin (); HTTPD::UserAdmin ->new(DB => "
While that group may still be found on some news servers, it is unwise to use it, because postings there ... will not appear on news servers which honour the official list of group names.
:-) If you want to override a predefined function, such as open(), then you'll have to import the new
See perlhist (new as of 5.005) for Perl's milestone releases. ... www.xray.mpe.mpg.de/mailing-lists/perl5-porters/ and http://archive.develooper.com/perl5-porters@perl.org/ or the news
You are probably using "main::foo" in new Perl code anyway, so this shouldn't be an issue.
all the .c files in the current directory, leaving a backup of the original data from each file in a new
without dynamic loading, then you just need to replace step 3 (make) with make perl and you will get a new
my $str = 'Haarlem'; # in the Netherlands $str =~ tr///cs; # Now Harlem, like in New
arrays: use Array::Iterator::Circular; my $color_iterator = Array::Iterator::Circular->new
use HTTP::Request::Common qw(POST); use LWP::UserAgent; $ua = LWP::UserAgent->new();
First, adding the new possesive + to any quantifier finds the longest match and does not backtrack. ... Second, the new (?PARNO) refers to the sub-pattern in the particular capture buffer given by PARNO.
There are also many other sub-domains for special topics like learning Perl, Perl news, jobs in Perl,
MakeMaker for more information (in brief, just use make perl instead of a plain make to rebuild perl with a new
use File::Stream; my $stream = File::Stream->new( $filehandle,
filehandle you want to affect, call the Cls method: Win32::Console; $OUT = Win32::Console->new
use CGI; my $cgi = CGI->new(); my $total = $cgi->param( 'price' ) + $cgi->param( 'shipping
IPC::Open3; use Symbol qw(gensym); use IO::File; local *CATCHOUT = IO::File->new_tmpfile ... ; local *CATCHERR = IO::File->new_tmpfile; my $pid = open3(gensym, ">&CATCHOUT", ">&CATCHERR
to the list this way: my ($head, $tail); $tail = append($head, 1); # grow a new
If Perl is new (and thus scary) to them, find something that Perl can do to solve one of their problems
able use the CPAN module Mail::Mailer: use Mail::Mailer; $mailer = Mail::Mailer->new
bless-able) $fh = *SOME_FH{IO}; # blessed IO::Handle from *SOME_FH typeglob Or, you can use the new ... use IO::Handle; # 5.004 or higher $fh = IO::Handle->new(); Then use any
For more information on file locking, see also "File Locking" in perlopentut if you have it (new for
use ExtUtils::Installed; my $inst = ExtUtils::Installed->new(); my @modules = $inst
echo, $noecho, $fd_stdin); $fd_stdin = fileno(STDIN); $term = POSIX::Termios->new
d'; my $p_iterator = Algorithm::Permute->new ( \@array ); while (my @perm = $p_iterator
Left and right padding with any character, creating a new string: $padded = $pad_char x ( $pad_len
If things aren't broken, upgrading perl may break them (or at least issue new warnings).
wide web support; server and daemon utilities; archiving and compression; image manipulation; mail and news
reporting in one step with the -p switch to <dprofpp>: dprofpp -p program.pl The Devel::NYTProf (New
$echo, $noecho, $fd_stdin); $fd_stdin = fileno(STDIN); $term = POSIX::Termios->new
. $+[0] * 8; } Or use the CPAN module Bit::Vector: $vector = Bit::Vector->new
in trying it out, firstly because strictly speaking it is not a vi clone, it is the real vi, or the new