Search Results

Search: Posts Made By: new bie
5,762
Posted By new bie
Yes, it's solved. Thanks a million radoulov. ...
Yes, it's solved. Thanks a million radoulov.

new bie
5,762
Posted By new bie
Hi radoulov, Here's what I typed in: ...
Hi radoulov,

Here's what I typed in:

#!/usr/bin/perl -w

die "Usage $0 directory\n" if @ARGV != 1;
opendir (D,$ARGV[0]) or die $!;

my @files;
-d or push @files, [ -s, $_ ]
for...
5,762
Posted By new bie
Thanks for replying radoudov. I typed in your...
Thanks for replying radoudov. I typed in your code but i got this error:
"Substitution replacement not terminated at grep.pl line 24" which is the print map line.

However, I was able to do it...
5,762
Posted By new bie
A perl script to list files
Hi guys,

I'm learning grep and map functions in perl and ran into a problem.
I have a little script below:

#!/usr/bin/perl -w

die "Usage: $0 dir\n" if @ARGV != 1;
opendir (D, $ARGV[0]) or...
1,475
Posted By new bie
Thanks for replying k_manimuthu, I've tried the...
Thanks for replying k_manimuthu, I've tried the script you suggested and it worked fine. However, it only print out the newest key/value pairs of repeated pairs. I'd like to print all key/value pairs...
1,475
Posted By new bie
list of hashes
Hello everyone,

I was wondering if someone can help me with this problem:


@LoHashes = ({"a"=>1,"b"=>2,"c"=>3,"d"=>4},
{"a"=>5,"b"=>6,"c"=>7});

@LoHashes =...
2,599
Posted By new bie
Grep and map in perl
Hi guys,

I'm trying to learn grep and map and having a little problem.

Let's say I have a file which contains:
Apple: abcdcabdadddbac

I want to replace any combinations of three of abcd,...
1,942
Posted By new bie
Thank you so much K_Manimuthu, your explanation...
Thank you so much K_Manimuthu, your explanation really help me understand the process when assign to @ARGV, really appreciate it.

New bie
1,942
Posted By new bie
Print matching lines in a file
Hello everyone,

I have a little script below:

die "Usage infile outfile reGex" if @ARGV != 3;
($regex) = @ARGV;

open(F,$ARGV[0]) or die "Can't open";
open(FOUT,"+>$ARGV[1]") or die "Can't...
1,265
Posted By new bie
printing keys only using map
Hello everyone,

Can anyone give me a suggestion on lines below:

%hash = map {($_, -M "$dir/$_")} readdir D;
print map "$_\n", sort values %hash;

The thing is this will print the floating...
2,202
Posted By new bie
sure, ls -l <dir_name> -rw-r--r-- 1...
sure,

ls -l <dir_name>

-rw-r--r-- 1 s98820 unix 18 Nov 12 13:06 a
-rw-r--r-- 1 s98820 unix 137 Nov 12 12:09 command

---------- Post updated at 09:42 PM ---------- Previous update was at...
2,202
Posted By new bie
thanks for your help Radoulu. However, the script...
thanks for your help Radoulu. However, the script above doesn't print out the date right- different day, month, and year.

new bie,
1,886
Posted By new bie
Hi Durden_Tyler, I understood your script...
Hi Durden_Tyler,

I understood your script above- your code named f27.pl and then you run it by perl f27.pl to get the output below it.

What got me confused was I wrote the same code above using...
1,886
Posted By new bie
thank you Tyler, I notice you cat the...
thank you Tyler,

I notice you cat the script. I was using vi editor to write that script. Does that mean I can't use vi editor to write my script when it comes to Find command? I had...
1,886
Posted By new bie
use File::Find function
Hello,

I'm learning the perl's Find function using unix but I keep getting this error when running the script:

"Not a CODE reference at /usr/lib.perl5/5.8.8/File/Find.pm line 822" - what does...
2,202
Posted By new bie
print out date of files last created??
Hello everyone, I have this script here:

use Time::Local;

opendir (D, $ARGV[0]) or die "Cant open";

foreach $file (readdir D)
{
$path = "$ARGV[0]/$file";
next if ! -T $path;

...
3,229
Posted By new bie
thx a million C, really appreciated. Just one...
thx a million C, really appreciated. Just one more question:

$dirname."/".$filename => what does this do? Making a path?

---------- Post updated at 05:01 PM ---------- Previous update was at...
3,229
Posted By new bie
using File::stat
Hello everyone,

I need some help on a perl script. The script is to open a dir and print out the date of last modification on all files. I'm been trying this code but it doesn't work.

use...
Showing results 1 to 18 of 18

 
All times are GMT -4. The time now is 04:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy