Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Perl looks ugly to novices?

Name: Anonymous 2012-08-25 21:58

I thought the whole point of Perl was that there were so many ways to code something, there's always a way to make the code look elegant.
From Larry Wall:
Perl is designed to give you several ways to do anything, so consider picking the most readable one.
This contrasts languages like Ruby which basically encourage/force you  to do things a specific way.

Just read this quote
I have a pretty major problem with a language where one of the most common variables has the name $_
Except you never have to use $_ in the first place. It's always a choice

In conclusion, people who don't like Perl don't know how to use it.

Name: Anonymous 2012-08-26 0:24

can you post a link to a single piece of perl that can be read by the average programmer who doesn't know perl? I don't know Java but can get a reasonable impression of what the code does by looking at it, with perl all I see is line noise...

Name: Anonymous 2012-08-26 0:27

Perl is ugly.

Name: Anonymous 2012-08-26 1:03

>>3
But, but.. it's beautiful on the inside!

Name: Anonymous 2012-08-26 1:04

>>4
If by ``beautiful'' you mean ``slow as fuck''.

Name: Anonymous 2012-08-26 1:17

>>5
If by ``slow as fuck'' you mean ``faster than python''.

Name: Anonymous 2012-08-26 2:07

>>6
If by ``faster than python'' you mean ``ONE WORD: /THE FORCED MOLASSIFICATION OF THE RUNTIME, THREAD OVER/''

Name: Anonymous 2012-08-26 4:29

>>4
so's your waifu
I would know

I bet you like NTR, don't you?

fagget

Name: Anonymous 2012-08-26 5:07

>>2
What about this? Takes a normally delimited data file and adds a column which is just the sum of the other columns

#!/usr/local/bin/perl
use strict;
use warnings;

sub f(@); #function declaration taking an array as an argument
my $line;
my ($field, @fields);
my $file_name = $ARGV[0];

open(my $source_file, $file_name) || die $!;
open(my $destination_file, ">$file_name.tmp") || die $!;

while($line = <$source_file>) { #read one line at a time, store in $line
  @fields = split(/\s+|,/, $line); #split line into an array with whitespace or comma as delimiter
  foreach $field(@fields) {
    print $destination_file "$field\t";
  }
  print $destination_file f(@fields);
  print $destination_file "\n";
}

close($source_file);
close($destination_file);

unlink($file_name) || die $!;
rename("$file_name.tmp", $file_name) || die $!;

sub f(@) {
  my @array = @_;
  my $value = 0;
  my $item;

  foreach $item(@array) {
    $value += $item;
  }
  return($value);
}


It can still be cleaned up, but claiming that that can't be read by a a programmer who doesn't read know perl is silly. Any decent programmer can read that.

Name: ... 2012-08-26 7:40

Stop OP. If you read the wikipedia article at the least, you would have not touched perl. It is Syntactic Meth.

Is you want something clean, and easy to read, but for scripting, use any of the following.

MAWK,mksh,LISP,Lua.

smalltalk is still nice, but I do not know what you need to learn perl. So I choose the ones that cover scriping, that can be compiled, and that the abstracts can be read, and parsed well by the eye.

If you can compile, stick to any asm, C, Haskell, LISP, Ada, Pascal.

At the end of the day, it all comes down to, who will read the code after you, and is this well laid out and EXPLAINED. You are solving problems, not making poetry. So write your code well, and give descriptions and examples of your functions. Comments and README text files exist for a reason.

Join BRAINFUCK or any asm if you want extra optimization. Documentation is still available for the needful.

;tldr
Perl is meth
LISP is math
Haskell is myth.

Name: Anonymous 2012-08-26 11:52

>>8
le /a/ is epic xD

Name: Anonymous 2012-08-26 12:11

>>9
Takes a normally delimited data file and adds a column which is just the sum of the other columns
``He or she''[1] asked you for Perl code that ``they''[2] could read and figure out for themselves, and then you proceed to explain the code before you even post it. Please try again!

________
* [1] Checking my male programmer privilege there.
* [2] Playing the pronoun game here.

Name: Anonymous 2012-08-26 14:02

>>12
Every program should have a text like this at the beginning. It's a good practice.

I do it in every program i write, in POD, Javadoc or the appropiate doc markup.

YOU SHOULD DO IT TO. IF NOT, YOU SHOULD FEEL BAD.

Name: Anonymous 2012-08-26 14:10

>>1
>This contrasts languages like Ruby which basically encourage/force you  to do things a specific way.
How so?

Name: Anonymous 2012-08-26 18:24

>>2
that's probably only because java syntax is very similiar to c/c++ syntax and pretty much everyone know these.

Name: Anonymous 2012-08-26 18:43

>>10
I can't tell if this is a serious post. If I read the Wikipedia article before learning Perl, I would have not learned Perl?

But I did better than reading the Wikipedia article, I actually fucking learned the language.

Name: Anonymous 2012-08-26 19:51

>>12
``He or she''
That fails to account for people outside the gender binary.  Just use singular ,,they'', and kick in the genitalia anyone who uses faggot shit like ,,ey'' or ,,zie''.  Also, please murder brutally anyone who spells ,,woman'' as ,,womyn''.

Name: Anonymous 2012-08-26 20:50

>>17
Singular ``they", like singular ``you", is PIG DISGUSTING.
Such abominations should be dealt with swiftly and permanently.

Name: Anonymous 2012-08-26 20:59

>>18
And replace them with what?  Alternating masculine and feminine pronouns is incredibly annoying, and ey/zie gets my prescriptivist senses tingling.

Name: Anonymous 2012-08-26 21:08

>>19
We got by just fine for centuries without a masculine singular third person pronoun, we don't need one now. As for singular ``you", what's wrong with ``thee"?

Name: Anonymous 2012-08-26 21:12

>>20
What we need is a gender-neutral third person pronoun; we do need one now because not everyone who can read is male.

Name: Anonymous 2012-08-26 21:32

>>21                         `
>implying

Name: Anonymous 2012-08-26 21:35

not using javascript for everything
get on my level, ``faggots''

Name: Anonymous 2012-08-26 21:38

>>22
XD LE EPIC MEME /B/RO

Name: Anonymous 2012-08-26 21:39

>>17-21
What we need is feminists to fuck off back to /adv/.

Or use ``the programmer".

Name: Anonymous 2012-08-26 21:46

>>21
'them'

Name: Anonymous 2012-08-26 22:30

>>21
We already have ``he" for that. We don't need to turn it into a masculine pronoun simply because of ``feminists" who for some reason cannot understand that a language as widely used as English would have a feminine pronoun without a corresponding masculine one.

Name: Anonymous 2012-08-26 22:41

>>27
I propose ``heshe'' for that

Name: Anonymous 2012-08-26 22:45

Name: Anonymous 2012-08-26 23:24

When women make up the totalarity programmers in the field, then it would be apt to use ``she''.
Also >caring what feminazis cry about
It's like you guys don't know feminism has always been nothing but civilizational subversion at the hands of kike spindoctoring.

Name: Anonymous 2012-08-26 23:55

>>30
Who are you trying to quote?

Name: Anonymous 2012-08-27 0:26

>>25
No, you fuck off.

>>26
That's the ,,singular they'' solution, which is probably the only solution that isn't awkward as fuck and that doesn't introduce a bunch of ugly words that would morph the English language into an abomination.

>>27,30
The neutral ,,he'' solution is ambiguous as it might mislead you to assuming masculine gender for the person it is referring to.

>>30
You are a retarded, racist, sexist, and idiotic piece of shit.  It isn't only your opinion about feminism that is misguided, it's your entire worldview.  Die in a fire, cretin.

Name: Anonymous 2012-08-27 0:39

>>32
Shalom hymie.
And the person is always going to be male gender when it comes to programming. But keep trying, it's cute.

Name: Anonymous 2012-08-27 0:49

Thanks for ruining the thread with all this sex war bullshit, faggots.

WYPMP

Name: Anonymous 2012-08-27 1:47

>>33
implying implications

Name: Anonymous 2012-08-27 2:12

>>22,30,35
If these people died of a heart attack, /prog/ would improve by at least three-fold.

Name: Anonymous 2012-08-27 2:51

>>36
If you don't like it get the fuck out nigger.

Name: Anonymous 2012-08-27 3:04

>>37
May you end up in the emergency room and not make it out alive. I bid you good day, sir.

Name: Anonymous 2012-08-27 3:32

>>38
There wont even be any emergency rooms left long before I'll ever be able make use of one, you on the other hand...

Name: Anonymous 2012-08-27 6:15

>>16
Good then. I hope contribute good written code. What I am attacking is mainly that you can do one thing well in any compiled language, and in Perl you can do it 100 ways. The reason stems from the language being mostly syntatic sugar.

I agree, the language is awesome when you have programming experience. It saves time when you only have to use N amount of macros for what you need, an deploy a quick solution. And it is why the language is adored in business.

However, you and I know that the next person will not be able to read the macros, and debugs errors that stem from virtual functions, because you must learn the other's person macro language. More time is dedicated on reverse engineering Perl code that has already grown for entire servers interfaces or applications, than optimizing.

However the subject is readability. If we are talking about eyes, I listed the in order the ones you need. If you need abstracts, I listed those too (not in order).

Above all, I am great believer on doing something right the first. But above all, optimization.

I believe we had a thread about this, the shittyCase one. Ah:
https://dis.4chan.org/read/prog/1344869235
>>11

night

Name: Anonymous 2012-08-27 15:07

>>40
Isn't the point of the thread that the abuse in unreadable macros is a choice?

Name: Anonymous 2012-08-27 19:23

skip to perl6 already!

Name: Anonymous 2012-08-27 19:23

>>42
not a single implementation!

Name: Anonymous 2012-08-27 19:29

>>32
No, you fuck off.

Name: Anonymous 2012-08-27 20:02

>>44
No, >>32 is correct, you really need to fuck off

Name: Anonymous 2012-08-27 22:03

>>45
Why?

You fuck off.

Name: Anonymous 2012-08-28 5:10

>>45
This might surprise the readers, but >>45 is >>32 but >>44 is not >>30
Kindly fuck off hymie.

Name: Anonymous 2012-08-28 6:26

>>41
If so, as long as it is readable, and comprehensible, I am all for it. We do not want to make the mess that the RSA Perl decrypt script is:
http://www.cypherspace.org/rsa/

night! I was drunk when I made >>40 , I yield my apologies for my butchered English

Don't change these.
Name: Email:
Entire Thread Thread List