![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| perl-like split function for bash? | eur0dad | Shell Programming and Scripting | 5 | 09-05-2008 06:23 PM |
| sort function in perl | DILEEP410 | Shell Programming and Scripting | 2 | 09-14-2007 08:03 AM |
| accessing a function in ksh from perl | ahtat99 | Shell Programming and Scripting | 2 | 01-15-2007 08:38 AM |
| perl split function | new2ss | Shell Programming and Scripting | 5 | 06-08-2006 10:17 PM |
| perl function call tracking | thumper | Shell Programming and Scripting | 1 | 11-24-2005 09:49 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | 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, |
|
||||
|
Quote:
Pass by reference. Code:
my ($r_file , $count , $key ) = @_; my @file = @$r_file; Code:
&printLines(\@fa,3,$symbolkey); |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|