[ create a new paste ] login | about

Link: http://codepad.org/BxKNI7xF    [ raw code | output | fork ]

Perl, pasted on Apr 22:
use warnings;
use strict;

my $hash_name;
while (<DATA>) {
  if (/%(\S*).+?=\s*\(/) {
    $hash_name = $1;
  }
}
print $hash_name;

__DATA__
my %address = (

or any such similar line in which i have defined the hash.

I want to find the character "(" in the line and store "address" in say $hash_name. How do I do it?

Basic idea is to capture the name of the hash defined in the files.

I am trying to do is,

foreach $line <MYFILE> {
  if($line =~ /($/ {


Output:
1
address


Create a new paste based on this one


Comments: