Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

perl

  • 22-03-2004 6:38pm
    #1
    Closed Accounts Posts: 346 ✭✭


    what exactly is perl used for?


Comments

  • Closed Accounts Posts: 920 ✭✭✭elvis2002


    I suppose Perl is a programmer's programmer language. Its not like Java and Perl, you don't need to define variables and stuff like that.

    Hello world in perl is simply print "Hello World";,

    I think Perl is used mostly for Pattern Matching. Snooping packets Etc, Socket Programming and CGI i think uses perl


  • Closed Accounts Posts: 346 ✭✭coolio_64


    Thanks elvis

    Would it be uesful to know it inside out?


  • Registered Users, Registered Users 2 Posts: 538 ✭✭✭raphaelS


    http://www.perl.org this will give you a good idea of what, how, when...

    From what I've seen of it:
    - it is easy to learn, compare to Java for example
    - a bit more advance than PHP, for operations on strings for example.

    Now, from a job point of view, you will find plenty of offers for a "Java, Perl, PHP and SQL" guy than just a "Perl" guy... If you know a language already, then look into Perl and you should know enough in no time.

    Raphael


  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    Perl would be primarily used for scripting (automating handy tasks) and CGI web scripts.

    It's a loosely-typed language, with a lot of emphasis on context, and extremely powerful text manipulation. Like PHP, it can be a bit fiddly to begin with, but eventually scripts you write almost write themselves it's so simple.

    It would be a very useful skill to have.


  • Closed Accounts Posts: 53 ✭✭dmd


    I've seen perl used allot for once off scripts, say somebody needs $x from a huge file and the person doesn't want to use a big shell script.

    Also if a person does the same task is being done every day, somebody will want to automate it. Perl fits the bill for the automation of system administration quite well.

    http://aspn.activestate.com/ASPN/Cookbook/Rx/ show some of the common uses of perl. Also CPAN is very useful because it provides modules for interfacing with lots of things, from parsers to mail libraries to to to to.....


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,419 ✭✭✭nadir


    Perl imho is the best language i have seen, but unfortunately im not much of a programmer, I love to be better at perl and c++ , but it just takes so much time, and I find myself very slow to do anything. I love the syntax in perl and its power, afaik php is based on perl.

    This is a perl script I modded from the irssi site for displaying what you are listening to via xmms info pipe. Its small and simple, but I managed to change the format, and to get it to work with xmmplayer (the mplayer plugin for xmms).

    use Irssi;
    use vars qw($VERSION %IRSSI);
    use strict;

    $VERSION = '1.1.3';
    %IRSSI = (
    authors => 'simon - modded by nadir with xmmplayer support and other minor trimmies',
    contact => 'simon\@blueshell.dk',
    name => 'XMMS-InfoPipe Script',
    description => 'Returns XMMS-InfoPipe data',
    license => 'Public Domain',
    url => 'http://irssi.dk/',
    changed => 'Sun Mar 10 14:36:49 CET 2002',
    commands => '/np',
    note => 'Make sure InfoPipe is configured!'
    );

    sub cmd_xmms {
    my ($args, $server, $target) = @_;
    $args =~ s/\s+$//; #fix unneeded whitespaces after output dest.

    my (@t, $t, $ttotal, @SF, $SF, $kSF, @pos, $pos, $postotal, $title, @CB, $CB, $kCB);
    open xmms, '/tmp/xmms-info' || die; # if nothing happens, it probably
    # failed here!

    while(<xmms>) {
    if(/^Time: (.*)$/) {
    @t = split(/:/, $1);
    $ttotal = $t[0]*60 + $pos[1];
    $t = $1;
    $t =~ s/^([0-9]*):([0-9]{2})$/\1m\2s/; # convert to nice format
    }
    if(/^Position: (.*)$/) { $pos = $1;
    @pos = split(/:/, $1);
    $postotal = $pos[0]*60 + $pos[1];
    }
    if(/^Title: (.*)$/) { $title = $1; }
    if(/^Samping Frequency: (.*)$/) {
    @SF = $1;
    $kSF = $SF[0]/1000;
    }
    if(/^Current bitrate: (.*)$/) {
    @CB = $1;
    $kCB = $CB[0]/1000;
    }
    }
    close xmms;

    $pos = sprintf("%.0f", $postotal / (($ttotal)+1) * 100); # calc. position
    my $output = "now playing: $title: Sampling Frequency: $kSF kHz Current bitrate: $kCB kbps : $pos% of $t";
    if(!$server || !$server->{connected}) { # are we even connected?
    Irssi::print $output;
    return
    }
    if($args) { $server->command("msg $args $output"); }
    else { Irssi::print $output; }
    }

    Irssi::command_bind('np', 'cmd_xmms');



    Just check out the syntax, its so easy to understand, totally unlike c++, I hate the way c++ is so cryptic, when I try to do stuff in opengl i get lost way too quickly. But perl makes sence, you dont really need to be familiar with all teh tricks, and ins and outs. A simple tutorial, and your aweh.
    ww)


    haha, just noticed those smilies .
    hehe


  • Registered Users, Registered Users 2 Posts: 16,414 ✭✭✭✭Trojan


    [ code ] doesn't disable them (not that you used it)... you need to check "Disable Smilies in This Post".
    use Irssi;
    use vars qw($VERSION %IRSSI);
    use strict;
    
    $VERSION = '1.1.3';
    %IRSSI = (
      authors     => 'simon - modded by nadir with xmmplayer support and other minor trimmies',
      contact     => 'simon\@blueshell.dk',
      name        => 'XMMS-InfoPipe Script',
      description => 'Returns XMMS-InfoPipe data',
      license     => 'Public Domain',
      url         => 'http://irssi.dk/',
      changed     => 'Sun Mar 10 14:36:49 CET 2002',
      commands    => '/np',
      note        => 'Make sure InfoPipe is configured!'
    );
    
    sub cmd_xmms {
      my ($args, $server, $target) = @_;
      $args =~ s/\s+$//; #fix unneeded whitespaces after output dest.
    
      my (@t, $t, $ttotal, @SF, $SF, $kSF, @pos, $pos, $postotal, $title, @CB, $CB, $kCB);
      open xmms, '/tmp/xmms-info' || die; # if nothing happens, it probably
                                          # failed here!
      
      while(<xmms>) {
        if(/^Time: (.*)$/) {
          @t = split(/:/, $1); 
          $ttotal = $t[0]*60 + $pos[1];
          $t = $1;
          $t =~ s/^([0-9]*):([0-9]{2})$/\1m\2s/; # convert to nice format
        }
        if(/^Position: (.*)$/) { $pos = $1;
        @pos = split(/:/, $1); 
        $postotal = $pos[0]*60 + $pos[1];
        }
        if(/^Title: (.*)$/) { $title = $1; }
        if(/^Samping Frequency: (.*)$/) {
         @SF = $1;
         $kSF = $SF[0]/1000;
        }
        if(/^Current bitrate: (.*)$/) {
         @CB = $1;
         $kCB = $CB[0]/1000;
        }
      }
      close xmms;
      
      $pos = sprintf("%.0f", $postotal / (($ttotal)+1) * 100); # calc. position
    my $output = "now playing: $title: Sampling Frequency: $kSF kHz Current bitrate: $kCB kbps : $pos% of $t";
      if(!$server || !$server->{connected}) { # are we even connected?
        Irssi::print $output;
        return
      }
      if($args) { $server->command("msg $args $output"); }
      else { Irssi::print $output; }
    }
    
    Irssi::command_bind('np', 'cmd_xmms');
    


  • Closed Accounts Posts: 346 ✭✭coolio_64


    Thanks for the replies

    What other languages would be worth learning


  • Registered Users, Registered Users 2 Posts: 383 ✭✭cherrio


    PHP - http://www.php.net

    Java - http://java.sun.com

    Python (making a bit of a come back!) - http://python.org/


  • Closed Accounts Posts: 346 ✭✭coolio_64


    anything else?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 16,414 ✭✭✭✭Trojan


    You done learning all those already?

    C, C++, expect, sh, ksh, Fortran, COBOL, BASIC, VB... what do you want, an exhaustive list of all programming languages?


  • Registered Users, Registered Users 2 Posts: 593 ✭✭✭davmigil


    If you are looking for a language to teach yourself and can use it to do lots of useful stuff Perl is a great choice.

    A good book I would recommend is 'Learning Perl' from O'Reilly. Maybe not if you have never learnt any programming what so ever, but if you have even a smattering of programming knowledge you will pick it up well.

    Once you have mastered it a bit, you will have a much better idea what other languages would be good to learn.

    Have fun,

    David


Advertisement