Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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
Domain Nodelet?
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 pondering the Monastery: (2)
As of 2022-05-28 11:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (99 votes). Check out past polls.

    Notices?