||Apr 27, 2014 at 20:42 UTC
||Mar 26, 2015 at 11:39 UTC
(4 days ago)
|Motto:||How do you like them apples?|
|Curacy:||671st Monk in the Book, 2014-09-04|
|Unitarian Jihad name:||Mother Superior Mutual Assured Destruction of Appreciative Joy|
Mar 30, 2015 at 11:51 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.
Not affiliated with Tom Owad's applefritter.com.
For new users:
Introductions to the Monastery:
- PerlMonks for the Absolute Beginner
- The Perl Monks Guide to the Monastery
- PerlMonks FAQ
- New Monks
- Spirit of the Monastery:
Spirit of the Monastery:
relies upon a spirit of fellowship which places the responsibility for
brotherly conduct on the individual Monk.
Highly opinionated and informed contributions are encouraged, but never at the expense of
mutual respect among Monks, adherence to the agreed upon rules of the
Monastery, or the basic joy of perl.
Protection of these vital elements serves to eliminate adverse conduct
from the Monastery.
Such actions as taunting of other Monks, aggression in posts, belligerent
intimidation, intentional disrespect, or other self-aggrandizing
inconsiderate behavior are contrary to the Spirit of the Monastery
and must be avoided by all Monks.
- Don't bite the newbies
Always be civil. [...] Civility is simple: stick to the facts while avoiding demeaning remarks and sarcasm. It is not enough to be factual. You must also be civil. Responding in kind to incivility is not acceptable.
- "The first rule of ethics is "don't be a dick", from which all other rules logically follow."
- Re^7: RAM: It isn't free . . . (the aggrieved troll their troll)
- Re^4: When do we change our replies? (approving):
My main advice to everybody related to this is for one to only respond to questions where one has something helpful to offer in response and for which one is particularly suited to answer. [...]
If a question annoys you, then minimize your annoyance by immediately moving on to something more enjoyable for you. Please try to refrain from sharing your annoyance so that we all get to suffer from it. Most of you are probably even clever enough to figure out a lot of the questions that are likely to end up annoying you so you can avoid even clicking through to them in the first place.
If a question annoys everybody, then everybody will ignore it. The history of the internet says that's one of the best ways to end something. If the question doesn't annoy everybody, then we have a case of somebody asking a question and some others willingly answering the question via a web site. That sounds a lot like "success".
Further reading: Useful homenodes
Introductions to Perl and resources for learning Perl:
Introductions, first steps and general information:
Best practices and other information:
For non-IT folks, e.g. biologists:
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):
- Above all, welcome to the Monastery!
- 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.
- Describe what you want to accomplish. Be precise.
- 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.
- Remember, we're here to help, but we need your to help you.
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:
Also see ☞Unicode flags for database drivers further down.
Distros, packages etc. (e.g. for Windows users):
- CPAN: IO::Tee - write to many files/handles at once
- CPAN: List::Util - reduce, any/all, first, sum/product, min/max, pairgrep, pairmap etc.
- CPAN: List::MoreUtils - uniq, zip, etc.
- CPAN: List::AllUtils (the previous two in one convenient module)
- Missing from List::Util / List::MoreUtils / List::AllUtils: pairwise_distinct (workaround: uniq(@list) == @list).
- CPAN: List::Compare - union, intersection, differences, symmetric difference etc.
- Cargill's quandary:
Any design problem can be solved by adding an additional level of indirection, except for too many levels of indirection.
- References quick reference
Regular expressions, parsing and grammars:
Useful CPAN modules:
HOWTOs, BCPs, 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, in 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).
- UTF-8 text files with Byte Order Mark
- Check whether Perl thinks your data is UTF8: $flag = utf8::is_utf8($string);
- Unicode flags for database drivers:
- MySQL and UTF-8:
[...] MySQL offers a "charset" named UTF8. Guess what, it's not UTF8. It's actually a synonym for UTF8MB3, which is MySQL's bizarre internal "UTF8 except we only allow 3 bytes per character" rule. If you actually need UTF8 you must upgrade to a very new version and explicitly ask MySQL for "UTF8MB4".
Anybody who has used MySQL before can guess what happens if you try to insert actual Unicode data (say, an HTML-ised comment your PHP blogging framework wants to store) into one of these UTF8 columns. Afraid to incur your wrath with an error you probably haven't handled correctly, MySQL will quietly truncate the string, removing everything from the offending codepoint onwards. [...]
- Catching "Unicode non-character" warnings - with a good and exhaustive reply by Tom Christiansen (might be outdated)
Useful CPAN modules:
Scripts and tools:
Talks, articles, references, presentations and meditations:
Questions and discussions:
- Perl Reference Card v2 (PDF)
- Perl Best Practices Reference Guide (PDF)
- Rebase issues in Cygwin ("child_info_fork::abort: address space needed by 'IO.dll' (...) is already
occupied" etc.): rebaseall
- Dictionary of Algorithms, Data Structures, and Problems
- Suggestions for working with poor code
- Higher-order Perl:
- The Timeline of Perl and its Culture
- "Evil uses for Perl":
- Different programming languages:
- Rants and criticism:
- pissed off about functional programming
- PHP: a fractal of bad design
- C++: Is It Really a Cruel Joke?
- C++ Frequently Questioned Answers (FQA)
- Far More than Everything You've Ever Wanted to Know about Prototypes in Perl -- by Tom Christiansen
- Re: The future of Perl? (The why, and my take.)
I don't like Python. Every time I've used it, it feels like a poor substitute.
Kinda like listening to an Elvis impersonator or a Beetles [sic] tribute band. It/they completely miss the point of what makes the original great. They go to great lengths to copy the superficial things; accents, cloths, hairstyles, even mannerisms and facial ticks; but completely fail when it comes to the important stuff; the music. They may sing and play all the notes in the correct order and key. They may even fairly accurately emulate the sound and tone and feel of one particular performance of each song they play. But listen to 3 live performances of any given track by the original artist and you'll notice that they are all quite different. Different in ways that are mostly too subtle for me as a non-musician to describe well; but you're never in doubt they are they. Each performance is unique and valuable for its uniqueness; and for originality; and because it shows the skill and growth of the artist.
The tribute bands meanwhile are condemned to only emulate, because the moment they add some originality to the performance; they fail to be a tribute any more and become karioki.
And that's how it feels when I use Python. Like a tribute band that opted to break out of the mould and add its own stamp on the original. Along the way of adding its unique contributions, it lost something, and many somethings that made the original so good. So usable.
- Other (home)nodes with (lots of) information and links:
- Perl Obfuscator
- Seven Levels of Perl Mastery
- unmaintainable code
- Hiding the source code for a Perl program:
- Symbol names: Almost 28 new names for 32 old marks, Re: Almost 28 new names for 32 old marks
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?
I insist on being paid to use Windows products, sir!
-- Your Mother, Re^3: PerlWizard - A free wizard for automatic Perl software code generation using simple forms
No further rational discussion is possible here because I find your preferred style utterly abhorrent :)
-- BrowserUk, Re^3: Porting (old) code to something else
Remember the Perl motto: when in doubt, use a hash!
-- Athanasius, Re^3: Need help in extracting timestamp from the line in a file
Two monks sat together for lunch. The first monk said, "What do you see when you see me?"
The second replied, "I see a reflection of the Buddha."
The first, feeling nasty, said, "When I look at you, I see a pile of shit."
The second just smiled. The first turned angry. "Why are you smiling?"
The second replied, "What comes out of a man is a reflection of what's inside a man. I am filled with the Buddha nature, so everywhere I look, I see a reflection of the Buddha."