Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Really Basic but a biginner

Status
Not open for further replies.

Cmca123

Technical User
Joined
Jun 14, 2007
Messages
2
Location
GB
Hi,

I'd like to pass a varaible to my perl script and then print it, is $1 correct syntax. thanks

#!/usr/bin/perl
use strict;
use warnings;
$string = $1;
print $string;
 
its okay.. solution

my $var = $ARGV[0];
print $var1;
 
Alternatively
Code:
print $ARGV[0];

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::PerlDesignPatterns)[/small]
 
Hi

I would never believe that works better than the first code...
Code:
my $[red]var[/red] = $ARGV[0];
print  $[red]var[b][u]1[/u][/b][/red];

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top