In the above sample it should read:
perl perl.pl $VAR
---------
you can do the following:
$ export VAR='whatever'
and run:
myperl.pl
[HTML]#!/usr/bin/perl -w
defined($arg=sh ift(@ARGV)) && print "arg: $arg\n";
print "var: $ENV{'VAR'}\n";[/HTML]
will print:
var: whatever
./myperl.pl argumen...
User Profile
Collapse
-
Depending on what unix you are using maybe the system call "tail -n 11" will do what you want.Leave a comment:
-
Depending on how you need to process the data this might be useful (I'm reading from STDIN):
...Code:#!/usr/bin/perl -w use strict; my $index1=0; my $index2=0; my %vals; while (<>) { chomp; if (/^p (\d+) (\d+)$/) { $index1=$1; $index2=$2; } if (/^(-?\d+) (-?\d+)$/) { push(@{$vals{$index1}{$index2}}, ($1.";".$2));Leave a comment:
No activity results to display
Show More
Leave a comment: