I have more than 1 files in the directory. In bash, I can use
Code:
cd /work
for x in `ls`
do
:
:
done
to run for each file in the directory.
How about in perl script?
Code:
filepath="ABC1"
open(FILE, $filepath) or die "$filepath cannot be opened.";
while(<FILE>) {
:
:
}
close(<file>)
because the open command just open the file ABC1 only. If I have ABC2, ABC3,ABC4 and ABC5 files.... how to let perl script also can run for the other files?
Thanks for you advise.
Last edited by pludi; 10-09-2009 at 02:18 AM..
Reason: code tags please...
I have a question regarding running perl in the current process.
I shall demonstrate with an example.
Look at this.
sh-2.05b$ pwd
/tmp
sh-2.05b$ cat test.sh
#! /bin/sh
cd /etc
sh-2.05b$ ./test.sh
sh-2.05b$ pwd
/tmp
sh-2.05b$ . ./test.sh
sh-2.05b$ pwd
/etc
sh-2.05b$
So... (10 Replies)
Hi all
Recently i had finished a perl script. When i run manually, the script work fine.
But when i wanted to put the script in cron, it didn't get the same output as it run manually. I felt that it only execute the script until certain line then it stop as i see most of the related files didn't... (6 Replies)
I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Hello everyone,
I have two types of files in a directory:
*.txt
*.info
I have a perl script that uses these two files as arguments, and produces a result file:
perl myScript.pl abc.txt abc.xml
How can I run this script (in a "for" loop , looping through both types of files)... (4 Replies)
Hello
i want create perl script to connect remotely to another machine and run perl script
please note that the remote script check for different variables remotely and not located on local machine
also i want to know how to send interactive variables
i am trying to make script to... (2 Replies)
Hello,
I'm trying to run "csso" (minify css) in a CGI script from the web panel.
That is not working: Returns error 0;
my $cmd = qq`csso stylesheet.css > stylesheet.min.css`;
system($cmd);
But that is working:
my $cmd = qq`echo 'blabla' > stylesheet.min.css`;
system($cmd);
I'm... (12 Replies)
I have a VBA that creates a new directory folder and creates a new text file in that directory. I am trying to run a perl script from the VBA and have created a batch file that gets called from the VBA. That bat file uses a shell file to run a script. When the batch file is called I get the error... (0 Replies)
Linux System having all Perl, Python, PHP (and Ruby) installed
From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file
eg
eg
a Shell script run in a case statement call to run a php file, also Perl or/and Python file???
Like
#!/usr/bin/bash
....
....
case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies
LEARN ABOUT DEBIAN
arch::changes
Arch::Changes(3pm) User Contributed Perl Documentation Arch::Changes(3pm)NAME
Arch::Changes - class representing a list of changes
SYNOPSIS
use Arch::Changes qw(:type);
use Arch::Tree;
my $changes = $tree->get_changes;
print $changes->get_listing;
use Arch::Log;
my $changed = $log->get_changes->is_changed('to', "COPYING");
die "License was compromised" if $changed && $changed->{&MODIFY};
DESCRIPTION
Arch::Changes contains a list of elements, each representing a single tree change. Each change element is described by a hash with the
following fields:
type
The type of the change. Can be one of ADD, DELETE, MODIFY, META_MODIFY or RENAME.
is_dir
A boolean value indicating whether the affected tree element is a directory.
arguments
A list of arguments. The first element is always relative path of the affected tree element. For changes of type RENAME the first
argument is the old path and the second argument the new path name.
The type constants can be conveniently imported using the tag ":type".
use Arch::Changes qw(:type);
METHODS
The following methods are available:
new, add, count, get, get_listing, is_changed, dump, type_string, to_string.
new Creates a new, initially empty, changes list.
Typically it is called indirectly from method get_changes in Arch::Changeset, Arch::Tree or Arch::Log class.
add type is_dir arguments...
Adds a new change element to the list of changes.
Typically it is called indirectly from method get_changes in Arch::Changeset, Arch::Tree or Arch::Log class.
count
Returns the number of change elements.
get num
Returns the num-th change element or all if num is undefined.
get_listing
Generates a textual changes listing as produced by "tla changes".
is_changed to filepath [is_dir]
Verify whether the given filepath is modified by the changes. The to parameter may get boolean values "0", "1", "from" or "to", it only
affects RENAME changes, and in some sense ADD and DELETE changes. If to is set, then the given filepath is taken as the destination of
RENAME or ADD, otherwise as the source of RENAME or DELETE. The MODIFY and META_MODIFY changes are not affected, since the destination
and the source is the same file/dir.
If filepath is not modified by any changes, return undef.
Otherwise, return hash with possible keys ADD, DELETE, MODIFY, META_MODIFY and RENAME. The hash values are 1 in all cases except for
RENAME, then the value is the file name on the opposite side (i.e., the source of RENAME if to is true, and the destination if false).
Note, the valid return values for arch are: undef, hashref with one key (ADD or DELETE) or hashref with combination of one-to-three
keys (MODIFY, META_MODIFY and RENAME).
dump
Generates a dump of the changes list using Data::Dumper.
type_string change
Returns the change type string as produced by "tla changes".
to_string change
Generates a changes line for change as produced by "tla changes".
BUGS
Awaiting for your reports.
AUTHORS
Mikhael Goikhman (migo@homemail.com--Perl-GPL/arch-perl--devel).
Enno Cramer (uebergeek@web.de--2003/arch-perl--devel).
SEE ALSO
For more information, see tla, Arch::Changeset, Arch::Tree, Arch::Log.
perl v5.10.1 2005-10-23 Arch::Changes(3pm)