Comments (10)
You likely don't see it a lot because push my @thing,...
is very similar to my @thing =...
, since you're pushing into an empty array.
from perl5.
Sorry? Just to clarify... Are you saying you've not ever seen push my @thing
in any code?
from perl5.
And never having seen exactly even one example of my style
It's fine to have a personal style, but the docs are not the place to evangelize it. Especially when it is a lot easier to get this wrong than the obvious my @thing =...
and push @thing, ...
.
from perl5.
It is somewhat reminiscent of:
for my $item ( @items ) {
...
}
or:
chomp my $line = readline();
I also like this style and use it a lot, ie. defining/declaring/scoping variables in-place (rather than in a separate statement earlier).
I find it to be a lovely Perlism esp. where other languages lack this "shortcut".
from perl5.
I also like this style and use it a lot, ie. defining/declaring/scoping variables in-place (rather than in a separate statement earlier).
No one argued against declaring variables in-place per se, and in fact we have plenty of examples of that in our docs.
from perl5.
@jidanni The motto of perl is "There's more than one way to do it".
from perl5.
my @x
can be used in almost any place @x
can be used. It doesn't really need examples everywhere.
from perl5.
my @x
can be used in almost any place@x
can be used. It doesn't really need examples everywhere.
I wish the documentation would say just what you said too then. But it's never mentioned that either.
Anyway I've never seen anybody use the useage that I've presented. How did I figure it out? By accident!
from perl5.
Well that is very well and good that most people can immediately tell that they're all the same. But for us other people, they're totally two different animals. And never having seen exactly even one example of my style, I think it would be high time to throw a few on some Man pages. Thanks.
from perl5.
Maybe somewhere in the docs have a
Stick to the documented usage
You might have discovered different ways to write Perl expressions.
But we purposely don't document them. Please use the documented reliable syntax.
from perl5.
Related Issues (20)
- 5.40.0 onwards won't build Darwin fat binaries HOT 17
- Segmentation fault in Perl_csighandler3 when used XS with threads. HOT 10
- BBC: Blead Breaks File::Tabular HOT 10
- feature 'class': out of memory error if subclassing a class with an explicit new HOT 3
- t/op/try.t: one test fails during deparsing tests HOT 3
- strftime crashes with a blessed format HOT 3
- [doc] Bug in Perl Threads tutorial section "A Thread Pitfall: Deadlocks"
- BBC: Blead Breaks Mojolicious HOT 3
- Cross compilation HOT 2
- BBC: Blead Breaks CPAN HOT 4
- Class methods can still be replaced outside the class HOT 10
- BBC: Blead Breaks DBIx::Class HOT 2
- Extensive CPAN breakage from two code removal projects HOT 6
- Perl is always configured for AFS on RHEL9 and derivatives
- 0351a629e7 led to build-time failure in Class-MethodCache
- CPAN distributions broken by switch removal HOT 3
- BBC: Scalar-List-Utils-1.65 breaks Tie::RefHash::Weak HOT 10
- Deprecation of GIMME long promised but not yet scheduled
- Script run does not always confine digits to the same set of ten HOT 1
- goto &SUB segfaults with builtin::refaddr, reftype, stringify, etc
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from perl5.