Unix@nashikouen

teh place for hakin and computers. also site discussion.
[Return] [bottom] [Catalog]
Posting mode: Reply
submition rules
  • Allowed file types are: .jpg, .png, .gif, .webp, .mp4, .mov, .webm, .mp3, .wav, .ogg, .flac, .swf, .swf
  • maximum files: 3
  • maximum upload size: 40.00 MB
  • duplicate files are not allowed
  • posts will be displayed in UTC time
  • max comment size is 8048 characters
  • tripcodes are enabled
  • BBCode is enabled
  • [ download ] 224 KB (1280x853) casemod1.jpg

    post code things you find interesting.

    i am learning perl and there is some things that are quite cool like things restore after loop control.

    #!/usr/bin/perl
    $num = 6;
    foreach $num (1,2,3,4){
    print "$num ";
    }

    print $num; #this will print 6 as perl will restore the variable used after the for loop.


    and there is a defualt value $_ that has a lot of use. values in a foreach values of a array are the actual elements even if they are primitive


    #!/usr/bin/perl
    @nums = (1, 2, 3, 4);
    foreach (@nums){
    $_++;
    }
    print "@num\n"; # this will print 2 3 4 5 - and parentheses are optional


    another with the special varable is.

    #!/usr/bin/perl
    @nums = (1, 2, 3, 4);
    foreach (@nums){
    print(); #will use the $_ when thjere is no arguments.
    }



    [top]
    Delete Post: []
    Password:



    - you are running KotatsuBBS. a clear and easy to read image board software -