Repository navigation
Expand file tree
/
Copy pathfilehandler.pl
More file actions
executable file
·81 lines (63 loc) · 1.41 KB
/
Copy pathfilehandler.pl
File metadata and controls
executable file
·81 lines (63 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper qw(Dumper);
sub read_file {
#Another way to print contents on file in new line
#Enter Input as comma separated and output will be in new line.
print "Enter with comma separated, Ctrl-D to quit\n";
my @lines = <>;
chomp(@lines) ;
my $oldlines = join (',', @lines);
$oldlines =~ s/,/\n/xg;
print $oldlines;
}
read_file;
# sub read_from_file {
# ##Print All Names on New Line.
# local $/ = "";
# my $filename = $ARGV[0];
# open my $fh, "$filename" or die $!;
# while (<$fh>) {
# s/\s+$//;
# s/[\r\n]+/,/xg;
# s/,/\n/xg;
# print;
# }
# close $fh;
# }
# read_from_file;
# @names=(A,B,C,D,E);
# @names=join("\n", @names);
# print @names,"\n";
# sub read_file {
# #(@names, @out);
# @lines = <>;
# chomp(@lines);
# for $line(@lines) {
# @names = split /,/, $line;
# for $name (@names) {
# push @out, $name;
# }
# }
# for $item(@out) {
# print $item . "\n";
# }
# }
# read_file;
# sub read_me {
# # body...
# #Accepts Input and print out in List Format.
# my @arr = ();
# while (<STDIN>) {
# chomp($_);
# last if ($_ eq '');
# push(@arr, $_);
# }
# print Dumper(\@arr);
# foreach (@arr) {
# printf "%s\n", $_;
# }
# printf "Number of elements in \@arr: %d\n", scalar(@arr);
# }
#read_me;