![]() |
|
|
|
|
|||||||
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. Shell Script Page. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sort function in perl | DILEEP410 | Shell Programming and Scripting | 2 | 09-14-2007 05:03 AM |
| accessing a function in ksh from perl | ahtat99 | Shell Programming and Scripting | 2 | 01-15-2007 04:38 AM |
| perl-like split function for bash? | eur0dad | Shell Programming and Scripting | 2 | 07-16-2006 09:10 AM |
| perl split function | new2ss | Shell Programming and Scripting | 5 | 06-08-2006 07:17 PM |
| perl function call tracking | thumper | Shell Programming and Scripting | 1 | 11-24-2005 05:49 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
PERL function problem
I have perl script as follow.
------------------------------------------------------------------------ #! /usr/bin/env perl use strict; sub printLines { print "Inside the function.............\n"; my (@file , $count , $key ) = $_; print $count , $ key ; # It does not print this. ? } open(READ_FILE ,"simple.txt"); my @fa = <READ_FILE>; my $symbolkey = "MY_SYMBOL"; my $line; foreach $line (@fa){ if ($line =~ /$symbolkey/) { print $line ,"Match found .............\n"; &printLines(@fa,3,$symbolkey); } } close(READ_FILE); ------------------------------------------------------------------- Function gets called. But inside function , it does not print values of arguments. What is problem with it. Thank you, |
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
Pass by reference. Code:
my ($r_file , $count , $key ) = @_; my @file = @$r_file; Code:
&printLines(\@fa,3,$symbolkey); |
| Thread Tools | |
| Display Modes | |
|
|