I mean look at this : -
try
{
FileInputStream inStream = new FileInputStream( args[0] );
inStream = ("myFile.txt");
}
catch(IOException ioerr)
{
System.out.println( ioerr.toString() );
}
and compare it with this :-
open(FH,"myFile.txt") or die "Nope : $!\n";
or this:
die "Nope : $!\n" unless open(FH,"myFile.txt");
or this:
if (not open FH, 'myFile.txt')
{
print STDERR "Nope : $!\n";
exit;
}
or even this:
!open FH => 'myFile.txt' == 0 && die "Nope : $!\n";
Every one of those are (probably) valid Perl. And at a glance, they all look like they might kinda work. That's the tradeoff. A diagonal language like Perl, is terse and expressive, not only do you see the same thing done in several ways, you will revel in it. With orthogonal languages like Java, you code may be verbose and ugly, but everyone's code verbose and ugly in the same way, and there is less detective work involved.
It all depends on what you and your task need in a programming language. I like to think of Java as being egalitarian, where everyone writes the same code, and Perl as elitist, where you can soar with the eagles, or crash and burn like a flaming eagle who can't soar anymore.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.