special variables

Discussion in 'Perl Misc' started by julia, Mar 3, 2005.

  1. julia

    julia Guest

    Hi, all. I have been looking for some documentation that discusses the
    @$ (@$newRules) variables but I can't find the right information so I
    decrypt the subroutine.


    sub buildRulesSens {
    my ($sens, $exceptFile, $lang) = @_;

    @RULES_FILES = ();
    my $rulesPath = "$lang/rules/sens$sens";
    find \&lsRuleFiles, "$rulesPath";
    my $out = "$lang/rules_sens$sens.txt";

    my $conf = readConfFile($exceptFile);

    open (OUT, ">$out") or error("Cant open '$out'");
    foreach my $ruleF (@RULES_FILES) {
    printc "Processing rules file: $ruleF\n";
    print OUT "#<FILE>$ruleF<BODY>\n";
    my $newRules = buildRules($ruleF, $conf);
    foreach my $r (@$newRules) {
    print OUT "$r\n";
    }
    #trc('_rules', $_rules); die;
    }
    close OUT;
    }
     
    julia, Mar 3, 2005
    #1
    1. Advertising

  2. julia wrote:

    > Hi, all. I have been looking for some documentation that discusses the
    > @$ (@$newRules) variables but I can't find the right information so I
    > decrypt the subroutine.


    $newRules is a reference to an array. Using "foreach (@$newRules)" will loop
    over the elements in the array that $newRules refers to.

    For more about references, have a look at:
    perldoc perlreftut
    perldoc perldsc
    perldoc perllol

    sherm--

    --
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Hire me! My resume: http://www.dot-app.org
     
    Sherm Pendley, Mar 3, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jim Schueler
    Replies:
    2
    Views:
    444
  2. avnrao
    Replies:
    0
    Views:
    3,370
    avnrao
    May 7, 2004
  3. Replies:
    1
    Views:
    938
  4. Replies:
    9
    Views:
    961
  5. Alan Lake

    tk special variables

    Alan Lake, Mar 3, 2007, in forum: Ruby
    Replies:
    1
    Views:
    97
    Stefano Crocco
    Mar 3, 2007
Loading...

Share This Page