by forgotmypw17 · 5y ago · 0 comments
my $foo = GetFoo();
my $bar = GetBar($foo);
my $baz = GetBaz($bar);
As opposed to this: my $baz = GetBaz(GetBar(GetFoo()));
It takes a smidgen longer to write, but is much easier to read and understand when I'm looking at it 2 days later. my $baz = GetFoo()
|> GetBar
|> GetBaz;One of the other reasons I use this style is because it allows me to port code easily between different languages.
For example, aside from the "my" keyword, I can pretty much copy and paste the same code between PHP and Perl.