|
|
Up |
|
|
  |
Author: clearguy02clearguy02
Date: Feb 3, 2008 21:56
Hi all,
I have the following variable:
$a = "xxx_active_jsmith";
Now I want to strip ohf the prefix, xxx_active_ and want to store only
the id, jsmith into the variable $b. That means, it should be $b =
"jsmith";
How can I do that?
Thanks
J
|
| |
|
| |
5 Comments |
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Feb 3, 2008 18:03
This is an excerpt from the latest version perlfaq1.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 .
--------------------------------------------------------------------
1.8: Is Perl difficult to learn?
No, Perl is easy to start learning--and easy to keep learning. It looks
like most programming languages you're likely to have experience with,
so if you've ever written a C program, an awk script, a shell script, or
even a BASIC program, you're already partway there.
Most tasks only require a small subset of the Perl language. One of the
guiding mottos for Perl development is "there's more than one way to do
it" (TMTOWTDI, sometimes pronounced "tim toady"). Perl's learning curve
is therefore shallow (easy to learn) and long (there's a whole lot you
can do if you really want).
|
| Show full article (2.43Kb) |
|
| |
no comments
|
|
  |
Author: arzarz
Date: Feb 3, 2008 13:46
Hi,
Can I use substr() to do circular buffering? I'm reading a binary data
stream from a pipe, which I need to send out on another pipe, but
since speeds may differ, I need to do some intermediate buffering (up
to a maximum amount).
I have something like the following (simplified):
my $buffer = "";
my $offset = 0;
while (my $cb = read(INPIPE, my $data, 32768)) {
$buffer .= $data;
$bytes = syswrite(OUTPIPE, $buffer, $offset, length($buffer) -
$offset); # OUTPIPE is non-blocking
$offset += $bytes;
$buffer .= substr($buffer, $offset); # move buffer pointer to
offset
}
|
| Show full article (0.88Kb) |
|
10 Comments |
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Feb 3, 2008 12:03
This is an excerpt from the latest version perlfaq1.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 .
--------------------------------------------------------------------
1.7: How stable is Perl?
Production releases, which incorporate bug fixes and new functionality,
are widely tested before release. Since the 5.000 release, we have
averaged only about one production release per year.
Larry and the Perl development team occasionally make changes to the
internal core of the language, but all possible efforts are made toward
backward compatibility. While not quite all Perl 4 scripts run
flawlessly under Perl 5, an update to perl should nearly never
invalidate a program written for an earlier version of perl (barring
accidental bug fixes and the rare new keyword).
--------------------------------------------------------------------
|
| Show full article (1.61Kb) |
|
no comments
|
|
  |
|
|
  |
Author: inetquestioninetquestion
Date: Feb 3, 2008 07:54
The following perl script computes: union, difference, intersection,
and elements which only exist in each of the arrays passed as inputs.
However If either of the original arrays have the letters: m, q, s, or
y the script fails. Anyone have any suggestions as to what is going
on here?
-Inet
#!/usr/bin/perl
### Using the following letters in either array cause errors: m, q,
s, y
@ArrayA = (1, 3, 5, 6, 7, 8, a, b, c, d, e, f, g, h, i, j, k, l, o, p,
t, u, v, w, x, z);
@ArrayB = (2, 3, 5, 7, 9, x, z, n, r, t, u, v, A, B, C, D);
my ($union_ref, $isec_ref, $diff_ref, $aonly_ref, $bonly_ref) =
ArrayFunctions(\@ArrayA, \@ArrayB);
|
| Show full article (2.19Kb) |
|
3 Comments |
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Feb 3, 2008 06:03
This is an excerpt from the latest version perlfaq1.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 .
--------------------------------------------------------------------
1.9: How does Perl compare with other languages like Java, Python, REXX, Scheme, or Tcl?
Favorably in some areas, unfavorably in others. Precisely which areas
are good and bad is often a personal choice, so asking this question on
Usenet runs a strong risk of starting an unproductive Holy War.
Probably the best thing to do is try to write equivalent code to do a
set of tasks. These languages have their own newsgroups in which you can
learn about (but hopefully not argue about) them.
Some comparison documents can be found at
http://www.perl.com/doc/FMTEYEWTK/versus/ if you really can't stop
yourself.
--------------------------------------------------------------------
|
| Show full article (1.62Kb) |
|
no comments
|
|
  |
Author: Veli-Pekka TätiläVeli-Pekka Tätilä
Date: Feb 3, 2008 04:05
Hi,
What options do I have in Win32 if I'd like to use an audio engine that
can play multiple audio channels with volume and pan for each one? It
should also have the ability to separately load and play files and would
be cool if it could stream compressed music (ogg/mp3) from disk, too.
Pitch shifting and basic delay and filter based audio effects would be
nice extras.
SDL looks Ok to me, however, there's no pan parameter in the PPM release
() obtained via ActiveState (SDL-Perl 2.13). I read on the Web someone
faced the very same problem under Unix and patched the pan support
himself. Has that support migrated to any PPM binaries in Windows?
Here's the thread I found about it:
http://www.perlmonks.org/?node_id=598630
The lack of per channel pan seems to be a common problem in SDL, in that
the authors of the game GlTron have had to patch it in themselves, too:
http://listas.apesol.org/pipermail/sdl-libsdl.org/2001-March/015788.html
I'm also willing to try libs other than SDL and a bit of Googling
brought up Allegro and Fmod 3, URLs:
http://www.talula.demon.co.uk/allegro/
|
| Show full article (2.71Kb) |
|
no comments
|
|
  |
|
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Feb 3, 2008 00:03
This is an excerpt from the latest version perlfaq1.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 .
--------------------------------------------------------------------
1.16: How can I convince others to use Perl?
(contributed by brian d foy)
Appeal to their self interest! If Perl is new (and thus scary) to them,
find something that Perl can do to solve one of their problems. That
might mean that Perl either saves them something (time, headaches,
money) or gives them something (flexibility, power, testability).
In general, the benefit of a language is closely related to the skill of
the people using that language. If you or your team can be more faster,
better, and stronger through Perl, you'll deliver more value. Remember,
people often respond better to what they get out of it. If you run into
resistance, figure out what those people get out of the other choice and
how Perl might satisfy that requirement.
|
| Show full article (2.61Kb) |
|
no comments
|
|
|
|
|