Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Substitution in Perl
by moritz (Cardinal) on Oct 20, 2010 at 09:02 UTC
    So finally what wil be returned by @tmp?

    You can easily find out with

    use Data::Dumper; print Dumper \@tmp;
    Perl 6 - links to (nearly) everything that is Perl 6.
Re: Substitution in Perl
by CountZero (Bishop) on Oct 20, 2010 at 06:07 UTC
    Please, enclose your code in <code> ... </code> tags.

    It is impossible to make head or tails of your post.

    Also, did you actually run that code? What were your expectations and what did actually happen?

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      What does the following lines mean?

      sub getTargets { #getTargets($makeInfoRef->{$makeId}{cmd}) my $arg = $_[0]; my $cmd = $arg; $cmd =~ s/.*&amp;&amp;\s*\w*make //; $cmd =~ s/^\w*make //; $cmd =~ s/-+[\w-]+=?\s*[\w\.\:\;\\\/]*\s+//g; my @tmp = split(/\s+/,$cmd); return @tmp; }

      Actually the "cmd" variable has

       "emake --emake-cm=aceaagent01.mw.na.cat.com --emake-emulation=gmake --emake-root=Y:\; --emake-autodepend=1 --emake-tmpdir=d:\temp --emake-clearcase=vobs --emake-annodetail=file --win32 --keep-going -f Makefile_a4e4i3_serv_test_a4 --emake-class=BE_CM --emake-build-label=BE_T4F_ALPHA_6_BASE_2_ECJob39384 --emake-annofile=serv_test_a4_anno.xml --emake-historyfile=serv_test_a4_emake.data -B lib"

      So finally what wil be returned by that sub function? Can anyone explain me the logic behind this fuction?

        The routine finally returns "lib".

        It does so by deleting a lot of things which --for whatever reason-- are not considered interesting. Roughly speaking it throws away everything except words that are not preceded by "-" (minus) or "=" (equal), and are not a form of "make".

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: Substitution in Perl
by snape (Pilgrim) on Oct 20, 2010 at 07:35 UTC

    Your post does not make sense to me. Posts are HTML formatted. Please the article and then post your question.