The parable of the falling droplet
Or: a silly little mnemonic for record separators
Cue our Hero: a confused Perl coder getting $/ and $\ mixed up again, despite the mnemonics mentioned in perlvar.
Cue The Solution: the Falling Droplet!
Imagine, if you will, a falling droplet of rain. It knows that its purpose in life is to fall down and follow the path of least resistance down to its final destination in a convenient body of water somewhere nearby. Imagine, now, that this droplet encounters an obstacle: a leaning toothpick. It will slide down this toothpick, happily rolling down the obstacle and continuing on its way:
o <--- our brave droplet . . <--- the path our droplet follows . / . / . / ./ <-- the leaning toothpick ./ ./ .../ -------- <-- the ground
Now, take a small mental sidestep and think of input and output: I/O. In between I and O is ... a leaning toothpick. Imagine our brave droplet falling down on this particular toothpick. If the toothpick is leaning towards the right, the droplet will end up on the left of it, if it is leaning to to the left, it will end up on the right of it. Or, if the toothpick leans to the right, the droplet will end up with the I, or input, and consequently, it will end up with the O, or output in the other case.
Cue (finally) The Point: Stick a $ in front of our leaning toothpick, imagine our droplet, and there's our mnemonic:
I/O $/ - droplet falls to left, or I - input record seperator $\ - droplet falls to right, or O - output record separator
Silly, but true.
Robartes- who should really get some sleep now