cruise has asked for the wisdom of the Perl Monks concerning the following question:
when i run this code i lost $a and $b value#!/usr/bin/perl #===================================================================== +========== # # FILE: test.pl # # USAGE: ./test.pl # # DESCRIPTION: # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: YOUR NAME (), # COMPANY: # VERSION: 1.0 # CREATED: 2012/3/9 下午 03:23:45 # REVISION: --- #===================================================================== +========== use strict; use warnings; system("ls > z & ls > zz"); my $a = "z"; my $b = "zz"; foreach($a,$b) { print $_; my $fh; open $fh,"<$_"; while(<$fh>){ print $_; } close $fh; } print $a,$b;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: the variable is lost
by JavaFan (Canon) on Mar 09, 2012 at 10:43 UTC | |
|
Re: the variable is lost
by davido (Cardinal) on Mar 09, 2012 at 08:14 UTC | |
by cruise (Acolyte) on Mar 09, 2012 at 08:19 UTC | |
by davido (Cardinal) on Mar 09, 2012 at 08:21 UTC | |
by cruise (Acolyte) on Mar 09, 2012 at 08:42 UTC | |
by cruise (Acolyte) on Mar 09, 2012 at 08:26 UTC | |
by davido (Cardinal) on Mar 09, 2012 at 08:32 UTC | |
|
Re: the variable is lost
by ikegami (Patriarch) on Mar 09, 2012 at 22:59 UTC | |
|
Re: the variable is lost
by Anonymous Monk on Mar 09, 2012 at 08:32 UTC | |
by cruise (Acolyte) on Mar 09, 2012 at 09:06 UTC | |
by Anonymous Monk on Mar 09, 2012 at 09:18 UTC | |
by eyepopslikeamosquito (Archbishop) on Mar 09, 2012 at 09:36 UTC | |
by JavaFan (Canon) on Mar 09, 2012 at 10:52 UTC |