SparkeyG has asked for the wisdom of the Perl Monks concerning the following question:
In the following snippit, I wish to take the second match, $2, and pass it to a sub that will create a DB table.
The problem is that w/in the sub, the variable shows the entire line matched.
The output I am getting is:if ( /(^\s?>)(.*)$/ ) { print "$2\n"; &createTable($2); next; } sub createTable { print $_; }
The expected output would be, I thought...apples >apples trees >trees etc.. >etc..
JAPP SparkeyGapples apples trees trees etc.. etc..
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Passing $2 to a sub
by japhy (Canon) on Feb 13, 2001 at 22:53 UTC | |
by SparkeyG (Curate) on Feb 13, 2001 at 22:55 UTC | |
Re: Passing $2 to a sub
by baku (Scribe) on Feb 13, 2001 at 23:03 UTC | |
Re: Passing $2 to a sub
by Gloom (Monk) on Feb 13, 2001 at 22:56 UTC | |
by the_slycer (Chaplain) on Feb 13, 2001 at 23:13 UTC | |
by MeowChow (Vicar) on Feb 13, 2001 at 23:28 UTC |
Back to
Seekers of Perl Wisdom