jesuashok has asked for the wisdom of the Perl Monks concerning the following question:
In the above code the second line should not have any value in $1. but $1 still maintains the value which grabs in the previous line. how can I make the $1 to be refreshed in each loop ?#!/usr/bin/perl #use strict; my $line; while ( <DATA> ) { chomp; $line = $_; $line =~ /\s+<\w+\/?>(.*)<\/\w+>/; $line = $1; print "$line\n"; } __DATA__ <Table>First_Table</Table> <Table/> Output :- First_Table First_Table
if [jesuashok]; --$exp; __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to empty the built in variable
by GrandFather (Saint) on Feb 22, 2007 at 04:22 UTC | |
|
Re: how to empty the built in variable
by bobf (Monsignor) on Feb 22, 2007 at 04:23 UTC | |
|
Re: how to empty the built_in variable
by blazar (Canon) on Feb 22, 2007 at 09:24 UTC | |
|
Re: how to empty the built_in variable
by davorg (Chancellor) on Feb 22, 2007 at 09:37 UTC | |
|
Re: how to empty the built_in variable
by holli (Abbot) on Feb 22, 2007 at 17:06 UTC | |
|
Re: how to empty the built_in variable
by Moron (Curate) on Feb 22, 2007 at 13:23 UTC |