pinnacle has asked for the wisdom of the Perl Monks concerning the following question:
Question
I am trying to print line above the the regex in below program in if statement in the file. I am using $` but it does not display any output. I checked my syntax which is correct. Please assist
#!/usr/bin/perl use strict; open(ORA, "/usr/cle_un"); while(<ORA>){ print "test: $`\n" if /^Func_file_permission$/; } close(ORA);
File details
ram: 702 Func: Func_file_permission testing tam: 768 Func: Func_file_permission test cham: 803 Func: Func_file_permission test
I want my results to show:
ram: 702 tam: 768 cham:803
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: filehandle regex
by ikegami (Patriarch) on Nov 16, 2010 at 19:57 UTC | |
|
Re: filehandle regex
by jwkrahn (Abbot) on Nov 16, 2010 at 20:43 UTC | |
|
Re: filehandle regex
by 7stud (Deacon) on Nov 16, 2010 at 20:13 UTC | |
|
Re: filehandle regex
by JavaFan (Canon) on Nov 16, 2010 at 20:59 UTC | |
by pinnacle (Acolyte) on Nov 17, 2010 at 00:21 UTC | |
by CountZero (Bishop) on Nov 17, 2010 at 06:58 UTC | |
by JavaFan (Canon) on Nov 17, 2010 at 09:54 UTC | |
|
Re: filehandle regex
by CountZero (Bishop) on Nov 17, 2010 at 07:18 UTC | |
|
Re: filehandle regex
by aquarium (Curate) on Nov 16, 2010 at 22:38 UTC |