||Apr 27, 2014 at 20:42 UTC
||Jul 31, 2014 at 23:44 UTC
(3 hours ago)
Aug 01, 2014 at 04:53 CEST
|For this user:||Search nodes|
Howdy, partner! Name's Apple Fritter, pleasure to meet y'all! I use Perl, but I don't know that much about it (yet). I'm trying to change that, so I frequent the Monastery, reading others' answers and code to learn, and providing my own answers and code to hone my skills.
For new users:
Introductions to the Monastery:
Introductions to Perl and resources for learning Perl:
There's also many books dedicated to specific topics such as Perl/Tk, DBI, Perl and XML, CGI programming with Perl, and much much more; see Perl Reference Materials: Books for an (outdated) list.
Other lists and resources:
Reviews, opinions etc.:
Asking questions (on Perlmonks and elsewhere):
How to ask questions (based on ww, Re: Replace key pair value from one to other file):
- Read the instructions ("Asking questions effectively", "Formatting your write-up", below).
- Read the documentation.
- Show effort. Write some code; at the very least, try. Help is free; doing your job for you is not.
- Show us your code.
- Describe failures, expected results, and actual results.
- If applicable, show us verbatim (!) error messages/warnings.
- If applicable, give us some sample data.
- Give us the larger picture: tell us what you want to achieve, not just how you decided to go about achieving it. There may be better ways of doing it that you haven't contemplated.
Asking questions effectively:
Formatting your write-up:
Other places to get help:
Other places learn about Perl:
N.B. when crossposting to several sites, it is considered polite to inform readers of this and provide links to avoid unnecessary/duplicated effort.
For established users:
Distros, packages etc. (e.g. for Windows users):
- CPAN: File::ReadBackwards
- CPAN: Text::CSV.
- Don't attempt your own CSV file handling.
- set the binary and auto_diag attributes when creating a new Text::CSV object.
- use ->getline() rather than reading lines yourself and calling ->parse(), or your script will break on embedded newlines.
General tips and tricks:
- Keep in mind the difference between bytes, codepoints, and characters ("extended grapheme clusters"). Variable-length encodings (UTF8) complicate things. So do combining diacritics.
- "Magic incantation" for defaulting to UTF8 when opening files, and also for STD*: use open IO => ':utf8', ':std';. Actually, :encoding(UTF-8) may be better than :utf8, see Re: A UTF8 round trip with MySQL.
- hippo (Re: Matching/replacing a unicode character only works after decode()): "The correct order of operations for working with encoded data (whether utf8 or any other encoding) is:
If you don't decode your input you'll be comparing apples and elephants which is why your regex fails to match. However, if you do no operations on the data at all, then you can skip the middle three steps because your perl script in that case is just essentially a pipe between your input (eg. database) and your output (eg. web page)."
Scripts and tools:
Talks, articles, references, presentations and meditations:
Do not fear death, you will re-awaken to a world built with Perfect Perl 7 and no Python.
-- boftx, Re^3: Using die() in methods
the moment you try to separate the physical construction of code -- kloc, function points, abstracts test quantities -- from the intellectual processes of gathering requirements; understanding work-patterns and flows; and imagining suitable, appropriate, workable algorithms to meet them; you do not have sufficient understanding of the process involved in code development to be making decisions about it.
-- BrowserUk, Re: Nobody Expects the Agile Imposition (Part VII): Metrics
You were unlucky in the sense that your program seems to have remained valid Perl even with all variables removed.
-- Corion, Re: [OneLiner] What am I doing wrong in my regex?