Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Little annoying mistakes ... of others

by szabgab (Priest)
on Dec 06, 2008 at 17:11 UTC ( #728569=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    print "type in something: ";
    my $line = <STDIN>;
    $line = chomp $line;
    
  2. or download this
    print "type in something: ";
    my $line = <STDIN>;
    chomp $line;
    
  3. or download this
    my @data = qw(foo bar baz);
    @data = map { s/./X/ } @data;
    print "@data\n";
    
  4. or download this
    my @data = qw(foo bar baz);
    @data = map { s/./X/; $_} @data;
    print "@data\n";
    
  5. or download this
    my $filename = 'input.txt';
    open my $fh, '<', $filename || die $!;
    
  6. or download this
    open my $fh, '<', ($filename || die $!);
    
  7. or download this
    my $filename = 'input.txt';
    open(my $fh, '<', $filename) or die $!;
    
  8. or download this
    my @names = qw(A B C);
    foreach my $name (<@names>) {
        print "$name\n";
    }
    
  9. or download this
    my(@names) = ('A', 'B', 'C');
    use File::Glob ();
    foreach my $name (glob(join($", @names))) {
        print "$name\n";
    }
    
  10. or download this
    my $x = 42;
    if ($x = /x/) {
        print "ok\n";
    }
    
  11. or download this
    my $x = 42;
    print is_foo_or();
    ...
    sub foo {
        return 0;
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://728569]
Approved by GrandFather
Front-paged by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2014-09-20 03:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (152 votes), past polls