Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
[newbie] chomp acting weird (or me not understanding how it works??)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Michele Dondi, post: 4781070"] Please, _don't_! Even if this is meant to be only a minimal example typing something like open my $in, '<', 'test.txt' or die $! takes only a few more keystrokes. [snip all code] perldoc perlvar Please note that this doesn't _strictly_ match the description above (not that it matters, IMHO). Also, it _seems_ that '.' in the first field ends a sentence just as much 'LET()' in the second one does. Personally I found it overly clumsy and hard to follow, and being particularly lazy in this moment I didn't even try to understand it or to test it either. All in all, if I understand correctly the description of your task (and if you descripted it correctly in the first place!) I suppose you may want something along these lines: #!/usr/bin/perl -ln use strict; use warnings; push our @wordz, (split)[0]; print "@wordz" and @wordz=() if $wordz[-1] eq '.'; __END__ (Of course most probably you do _not_ want that whitespace before the period... ;-) Michele [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
[newbie] chomp acting weird (or me not understanding how it works??)
Top