=head1 NAME
-perlfaq3 - Programming Tools ($Revision: 1.4 $, $Date: 2001/10/02 19:42:02 $)
+perlfaq3 - Programming Tools ($Revision: 1.6 $, $Date: 2001/10/03 23:06:15 $)
=head1 DESCRIPTION
=head2 Is there a ctags for Perl?
-There's a simple one at
+Recent versions of ctags do much more than older versions did.
+EXUBERANT CTAGS is available from http://ctags.sourceforge.net/
+and does a good job of making tags files for perl code.
+
+There is also a simple one at
http://www.perl.com/CPAN/authors/id/TOMC/scripts/ptags.gz which may do
-the trick. And if not, it's easy to hack into what you want.
+the trick. It can be easy to hack this into what you want.
=head2 Is there an IDE or Windows Perl Editor?
way you do it, but it makes a huge difference when they start getting
larger.
+=item * Use map and grep selectively
+
+Remember that both map and grep expect a LIST argument, so doing this:
+
+ @wanted = grep {/pattern/} <FILE>;
+
+will cause the entire file to be slurped. For large files, it's better
+to loop:
+
+ while (<FILE>) {
+ push(@wanted, $_) if /pattern/;
+ }
+
+=item * Avoid unnecessary quotes and stringification
+
+Don't quote large strings unless absolutely necessary:
+
+ my $copy = "$large_string";
+
+makes 2 copies of $large_string (one for $copy and another for the
+quotes), whereas
+
+ my $copy = $large_string;
+
+only makes one copy.
+
+Ditto for stringifying large arrays:
+
+ {
+ local $, = "\n";
+ print @big_array;
+ }
+
+is much more memory-efficient than either
+
+ print join "\n", @big_array;
+
+or
+
+ {
+ local $" = "\n";
+ print "@big_array";
+ }
+
+
=item * Pass by reference
Pass arrays and hashes by reference, not by value. For one thing, it's
=head1 NAME
-perlfaq4 - Data Manipulation ($Revision: 1.2 $, $Date: 2001/09/26 15:42:12 $)
+perlfaq4 - Data Manipulation ($Revision: 1.3 $, $Date: 2001/10/03 23:08:02 $)
=head1 DESCRIPTION
The paragraphs you give to Text::Wrap should not contain embedded
newlines. Text::Wrap doesn't justify the lines (flush-right).
+Or use the CPAN module Text::Autoformat. Formatting files can be easily
+done by making a shell alias, like so:
+
+ alias fmt="perl -i -MText::Autoformat -n0777 \
+ -e 'print autoformat $_, {all=>1}' $*"
+
+See the documentation for Text::Autoformat to appreciate its many
+capabilities.
+
=head2 How can I access/change the first N letters of a string?
There are many ways. If you just want to grab a copy, use